All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: James Smart <james.smart@broadcom.com>,
	Kees Cook <keescook@chromium.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	linux-kernel@vger.kernel.org,
	Dick Kennedy <dick.kennedy@broadcom.com>,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] scsi: lpfc: Use struct_group to isolate cast to larger object
Date: Thu, 16 Dec 2021 23:04:43 -0500	[thread overview]
Message-ID: <163971367437.637.1523954588992475904.b4-ty@oracle.com> (raw)
In-Reply-To: <20211203223351.107323-1-keescook@chromium.org>

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

      parent reply	other threads:[~2021-12-17  4:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 22:33 [PATCH] scsi: lpfc: Use struct_group to isolate cast to larger object Kees Cook
2021-12-09 14:50 ` James Smart
2021-12-14  4:31 ` Martin K. Petersen
2021-12-17  4:04 ` Martin K. Petersen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163971367437.637.1523954588992475904.b4-ty@oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=dick.kennedy@broadcom.com \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.ibm.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.