Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631660

Re: [RFC PATCH] netxen_nic: null-terminate serial number string in netxen_check_options()

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] netxen_nic: null-terminate serial number string in netxen_check_options()
Date 2017-04-26 20:40 +0200
Message-ID <tAA14-61F-21@gated-at.bofh.it> (permalink)
References <tA3ou-1Iu-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Jerome Marchand" <jmarchan@redhat.com>
Date: Tue, 25 Apr 2017 09:42:29 +0200

> The serial_num string in netxen_check_options() is not always properly
> null-terminated. I couldn't find the documention on the serial number
> format and I suspect a proper integer to string conversion is in
> order, but this patch a least prevents the out-of-bound access.
> 
> It solves the following kasan warning:
 ...
> @@ -842,7 +842,7 @@ netxen_check_options(struct netxen_adapter *adapter)
>  {
>  	u32 fw_major, fw_minor, fw_build, prev_fw_version;
>  	char brd_name[NETXEN_MAX_SHORT_NAME];
> -	char serial_num[32];
> +	char serial_num[33];
>  	int i, offset, val, err;
>  	__le32 *ptr32;
>  	struct pci_dev *pdev = adapter->pdev;

Another problem is that the serial_num array is only 4-byte aligned by
accident.  Steps are necessary to make sure the ptr32 assignments don't
take unaligned traps.

Something like:

	union {
		char buf[33];
		__le32 dummy;
	} serial_num;

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[RFC PATCH] netxen_nic: null-terminate serial number string in netxen_check_options() "Jerome Marchand" <jmarchan@redhat.com> - 2017-04-25 09:50 +0200
  Re: [RFC PATCH] netxen_nic: null-terminate serial number string in  netxen_check_options() David Miller <davem@davemloft.net> - 2017-04-26 20:40 +0200

csiph-web