[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <163971367437.637.1523954588992475904.b4-ty@oracle.com>
Date: Thu, 16 Dec 2021 23:04:43 -0500
From: "Martin K. Petersen" <martin.petersen@...cle.com>
To: James Smart <james.smart@...adcom.com>,
Kees Cook <keescook@...omium.org>
Cc: "Martin K . Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
linux-kernel@...r.kernel.org,
Dick Kennedy <dick.kennedy@...adcom.com>,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] scsi: lpfc: Use struct_group to isolate cast to larger object
On Fri, 3 Dec 2021 14:33:51 -0800, Kees Cook wrote:
> When building under -Warray-bounds, a warning is generated when casting
> a u32 into MAILBOX_t (which is larger). This warning is conservative, but
> it's not an unreasonable change to make to improve future robustness. Use
> a tagged struct_group that can refer to either the specific fields or
> the first u32 separately, silencing this warning:
>
> drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_reset_barrier':
> drivers/scsi/lpfc/lpfc_sli.c:4787:29: error: array subscript 'MAILBOX_t[0]' is partly outside array bounds of 'volatile uint32_t[1]' {aka 'volatile unsigned int[1]'} [-Werror=array-bounds]
> 4787 | ((MAILBOX_t *)&mbox)->mbxCommand = MBX_KILL_BOARD;
> | ^~
> drivers/scsi/lpfc/lpfc_sli.c:4752:27: note: while referencing 'mbox'
> 4752 | volatile uint32_t mbox;
> | ^~~~
>
> [...]
Applied to 5.17/scsi-queue, thanks!
[1/1] scsi: lpfc: Use struct_group to isolate cast to larger object
https://git.kernel.org/mkp/scsi/c/c167dd0b2a7a
--
Martin K. Petersen Oracle Linux Engineering
Powered by blists - more mailing lists