From: Helge Deller <deller@gmx.de>
To: Sathya Prakash <sathya.prakash@broadcom.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org
Subject: mpt3sas_base.c:5396:40: warning: array subscript ‘Mpi2SasIOUnitPage1_t is partly outside array bounds of ‘unsigned char[20]’
Date: Thu, 31 Mar 2022 09:08:44 +0200 [thread overview]
Message-ID: <YkVTfIpkQ6u1hHXU@p100> (raw)
When compiling current kernel git head for the parisc platform I face compiler warnings:
CC drivers/scsi/mpt3sas/mpt3sas_base.o
In file included from linux/include/linux/swab.h:5,
from linux/include/uapi/linux/byteorder/big_endian.h:14,
from linux/include/linux/byteorder/big_endian.h:5,
from linux/arch/parisc/include/uapi/asm/byteorder.h:5,
from linux/arch/parisc/include/asm/bitops.h:11,
from linux/include/linux/bitops.h:33,
from linux/include/linux/kernel.h:22,
from linux/drivers/scsi/mpt3sas/mpt3sas_base.c:46:
linux/drivers/scsi/mpt3sas/mpt3sas_base.c: In function ‘_base_make_ioc_operational’:
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5396:40: warning: array subscript ‘Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds]
5396 | (le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth)) ?
linux/include/uapi/linux/swab.h:105:39: note: in definition of macro ‘__swab16’
105 | (__builtin_constant_p((__u16)(x)) ? \
| ^
linux/include/linux/byteorder/generic.h:91:21: note: in expansion of macro ‘__le16_to_cpu’
91 | #define le16_to_cpu __le16_to_cpu
| ^~~~~~~~~~~~~
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5396:14: note: in expansion of macro ‘le16_to_cpu’
5396 | (le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth)) ?
| ^~~~~~~~~~~
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5382:26: note: referencing an object of size 20 allocated by ‘kzalloc’
5382 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from linux/include/linux/swab.h:5,
from linux/include/uapi/linux/byteorder/big_endian.h:14,
from linux/include/linux/byteorder/big_endian.h:5,
from linux/arch/parisc/include/uapi/asm/byteorder.h:5,
from linux/arch/parisc/include/asm/bitops.h:11,
from linux/include/linux/bitops.h:33,
from linux/include/linux/kernel.h:22,
from linux/drivers/scsi/mpt3sas/mpt3sas_base.c:46:
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5400:40: warning: array subscript ‘Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds]
5400 | (le16_to_cpu(sas_iounit_pg1->SASNarrowMaxQueueDepth)) ?
linux/include/uapi/linux/swab.h:105:39: note: in definition of macro ‘__swab16’
105 | (__builtin_constant_p((__u16)(x)) ? \
| ^
linux/include/linux/byteorder/generic.h:91:21: note: in expansion of macro ‘__le16_to_cpu’
91 | #define le16_to_cpu __le16_to_cpu
| ^~~~~~~~~~~~~
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5400:14: note: in expansion of macro ‘le16_to_cpu’
5400 | (le16_to_cpu(sas_iounit_pg1->SASNarrowMaxQueueDepth)) ?
| ^~~~~~~~~~~
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5382:26: note: referencing an object of size 20 allocated by ‘kzalloc’
5382 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~~~~~~
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5403:43: warning: array subscript ‘Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]’ is partly outside array bounds of ‘unsigned char[20]’ [-Warray-bounds]
5403 | ioc->max_sata_qd = (sas_iounit_pg1->SATAMaxQDepth) ?
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
linux/drivers/scsi/mpt3sas/mpt3sas_base.c:5382:26: note: referencing an object of size 20 allocated by ‘kzalloc’
5382 | sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~~~~~~
Helge
reply other threads:[~2022-03-31 7:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=YkVTfIpkQ6u1hHXU@p100 \
--to=deller@gmx.de \
--cc=MPT-FusionLinux.pdl@broadcom.com \
--cc=jejb@linux.ibm.com \
--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