linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mpt3sas_base.c:5396:40: warning: array subscript ‘Mpi2SasIOUnitPage1_t is partly outside array bounds of ‘unsigned char[20]’
@ 2022-03-31  7:08 Helge Deller
  0 siblings, 0 replies; only message in thread
From: Helge Deller @ 2022-03-31  7:08 UTC (permalink / raw)
  To: Sathya Prakash, Sreekanth Reddy, Suganath Prabu Subramani,
	James E.J. Bottomley, Martin K. Petersen, MPT-FusionLinux.pdl,
	linux-scsi

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-31  7:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-31  7:08 mpt3sas_base.c:5396:40: warning: array subscript ‘Mpi2SasIOUnitPage1_t is partly outside array bounds of ‘unsigned char[20]’ Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).