]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
scsi: megaraid_sas: Add flexible array member for SGLs
authorKees Cook <keescook@chromium.org>
Fri, 6 Jan 2023 05:32:00 +0000 (21:32 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 4 Sep 2023 09:10:35 +0000 (11:10 +0200)
commit08c1bcdb97c237ca65b91df9af562cc8a8acec40
tree7728a16cf8a29045087f0f869d6912c5d44bb215
parentd154f6a7f6621115d2f92ddb943a3fc04b0975c9
scsi: megaraid_sas: Add flexible array member for SGLs

BugLink: https://bugs.launchpad.net/bugs/2029808
commit a9a3629592ab7442a2e9d40281420b51c453ea9b upstream.

struct MPI2_RAID_SCSI_IO_REQUEST ends with a single SGL, but expects to
copy multiple. Add a flexible array member so the compiler can reason about
the size of the memcpy(). This will avoid the run-time false positive
warning:

  memcpy: detected field-spanning write (size 128) of single field "&r1_cmd->io_request->SGL" at drivers/scsi/megaraid/megaraid_sas_fusion.c:3326 (size 16)

This change results in no binary output differences.

Reported-by: Holger Kiehl <Holger.Kiehl@dwd.de>
Link: https://lore.kernel.org/all/88de8faa-56c4-693d-2d3-67152ee72057@diagnostix.dwd.de/
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: megaraidlinux.pdl@broadcom.com
Cc: linux-scsi@vger.kernel.org
Link: https://lore.kernel.org/r/20230106053153.never.999-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Holger Kiehl <Holger.Kiehl@dwd.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/megaraid/megaraid_sas_fusion.h