Subject: Re: [Intel-wired-lan] [PATCH][next] ixgbe: Fix out-bounds warning in ixgbe_host_interface_command()

From: "Gustavo A. R. Silva" <[email-masked]>
Date: Tue, 11 May 2021 10:49:55 -0500

Hi all,

On 5/6/21 02:25, Switzer, David wrote:
> 
>> -----Original Message-----
>> From: Intel-wired-lan <[email-masked]> On Behalf Of
>> Gustavo A. R. Silva
>> Sent: Tuesday, April 13, 2021 12:04 PM
>> To: Brandeburg, Jesse <[email-masked]>; Nguyen, Anthony L
>> <[email-masked]>; David S. Miller <[email-masked]>; Jakub
>> Kicinski <[email-masked]>
>> Cc: Kees Cook <[email-masked]>; [email-masked]; linux-
>> [email-masked]; Gustavo A. R. Silva <[email-masked]>; intel-
>> [email-masked]; [email-masked]
>> Subject: [Intel-wired-lan] [PATCH][next] ixgbe: Fix out-bounds warning in
>> ixgbe_host_interface_command()
>>
>> Replace union with a couple of pointers in order to fix the following out-of-
>> bounds warning:
>>
>>  CC [M]  drivers/net/ethernet/intel/ixgbe/ixgbe_common.o
>> drivers/net/ethernet/intel/ixgbe/ixgbe_common.c: In function
>> ‘ixgbe_host_interface_command’:
>> drivers/net/ethernet/intel/ixgbe/ixgbe_common.c:3729:13: warning: array
>> subscript 1 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-
>> bounds]
>> 3729 |   bp->u32arr[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi);
>>      |   ~~~~~~~~~~^~~~
>> drivers/net/ethernet/intel/ixgbe/ixgbe_common.c:3682:7: note: while
>> referencing ‘u32arr’
>> 3682 |   u32 u32arr[1];
>>      |       ^~~~~~
>>
>> This helps with the ongoing efforts to globally enable -Warray-bounds.
>>
>> Link: https://github.com/KSPP/linux/issues/109
>> Co-developed-by: Kees Cook <[email-masked]>
>> Signed-off-by: Kees Cook <[email-masked]>
>> Signed-off-by: Gustavo A. R. Silva <[email-masked]>
>> ---
>> drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 16 +++++++---------
>> 1 file changed, 7 insertions(+), 9 deletions(-)
>>
> Tested-by: Dave Switzer <[email-masked]>

Thanks for this, Dave. :)

By the way, we are about to be able to globally enable -Warray-bounds and,
this is one of the last out-of-bounds warnings in linux-next.

Thanks
--
Gustavo