From: James Seo <james@equiv.tech>
To: Sathya Prakash <sathya.prakash@broadcom.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
Cc: James Seo <james@equiv.tech>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Kees Cook <keescook@chromium.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 0/6] scsi: mpt3sas: Use flexible arrays and do a few cleanups
Date: Tue, 25 Jul 2023 09:13:25 -0700 [thread overview]
Message-ID: <20230725161331.27481-1-james@equiv.tech> (raw)
Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") has
resulted in the only arrays that UBSAN_BOUNDS considers unbounded
being trailing arrays declared with [] as the last member of a
struct.
Unbounded trailing arrays declared with [1] are common in mpt3sas,
which is causing spurious warnings to appear in some situations with
UBSAN array bounds checks enabled, e.g. when more than one physical
disk is connected:
UBSAN: array-index-out-of-bounds in drivers/scsi/mpt3sas/mpt3sas_scsih.c:6810:36
index 1 is out of range for type 'MPI2_SAS_IO_UNIT0_PHY_DATA [1]'
which relates to this unbounded array access:
port_id = sas_iounit_pg0->PhyData[i].Port;
and is just one example of 10 currently occurring for me during boot.
This series converts most trailing arrays in mpt3sas into proper C99
flexible array members. Those that really are fixed-length arrays of
length >=1 are left alone.
I didn't find any conversions that required further source edits
besides changing [1] to [], and everything seems to work with my
SAS2008-based add-in card, but please look things over in case I
missed something subtle.
Rounding out the series are some opportunistic cleanups.
James Seo (6):
scsi: mpt3sas: Use flexible arrays when obviously possible
scsi: mpt3sas: Use flexible arrays when less obviously possible
scsi: mpt3sas: Use struct_size() for struct size calculations
scsi: mpt3sas: Fix an outdated comment
scsi: mpt3sas: Fix typo of "TRIGGER"
scsi: mpt3sas: Replace a dynamic allocation with a local variable
drivers/scsi/mpt3sas/mpi/mpi2_cnfg.h | 231 ++++++-------------
drivers/scsi/mpt3sas/mpi/mpi2_image.h | 32 +--
drivers/scsi/mpt3sas/mpi/mpi2_ioc.h | 27 +--
drivers/scsi/mpt3sas/mpt3sas_base.c | 28 +--
drivers/scsi/mpt3sas/mpt3sas_config.c | 6 +-
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 18 +-
drivers/scsi/mpt3sas/mpt3sas_transport.c | 9 +-
drivers/scsi/mpt3sas/mpt3sas_trigger_pages.h | 44 ++--
drivers/scsi/mpt3sas/mpt3sas_warpdrive.c | 3 +-
9 files changed, 135 insertions(+), 263 deletions(-)
base-commit: 7e9609d2daea0ebe4add444b26b76479ecfda504
--
2.39.2
next reply other threads:[~2023-07-25 16:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 16:13 James Seo [this message]
2023-07-25 16:13 ` [PATCH 1/6] scsi: mpt3sas: Use flexible arrays when obviously possible James Seo
2023-07-28 22:01 ` Kees Cook
2023-07-25 16:13 ` [PATCH 2/6] scsi: mpt3sas: Use flexible arrays when less " James Seo
2023-07-28 22:26 ` Kees Cook
2023-07-29 8:09 ` James Seo
2023-07-25 16:13 ` [PATCH 3/6] scsi: mpt3sas: Use struct_size() for struct size calculations James Seo
2023-07-25 16:13 ` [PATCH 4/6] scsi: mpt3sas: Fix an outdated comment James Seo
2023-07-28 22:27 ` Kees Cook
2023-07-25 16:13 ` [PATCH 5/6] scsi: mpt3sas: Fix typo of "TRIGGER" James Seo
2023-07-28 22:27 ` Kees Cook
2023-07-25 16:13 ` [PATCH 6/6] scsi: mpt3sas: Replace a dynamic allocation with a local variable James Seo
2023-07-28 22:29 ` Kees Cook
2023-07-29 8:35 ` James Seo
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=20230725161331.27481-1-james@equiv.tech \
--to=james@equiv.tech \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=gustavoars@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sathya.prakash@broadcom.com \
--cc=sreekanth.reddy@broadcom.com \
--cc=suganath-prabu.subramani@broadcom.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®