[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7cc1efed-1241-112d-2a12-6abeea323284@diagnostix.dwd.de>
Date: Fri, 6 Jan 2023 11:49:11 +0000 (GMT)
From: Holger Kiehl <Holger.Kiehl@....de>
To: Kees Cook <keescook@...omium.org>
cc: Kashyap Desai <kashyap.desai@...adcom.com>,
Sumit Saxena <sumit.saxena@...adcom.com>,
Shivasharan S <shivasharan.srikanteshwara@...adcom.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
megaraidlinux.pdl@...adcom.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] scsi: megaraid_sas: Add flexible array member for SGLs
On Thu, 5 Jan 2023, Kees Cook wrote:
> 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@....de>
> Link: https://lore.kernel.org/all/88de8faa-56c4-693d-2d3-67152ee72057@diagnostix.dwd.de/
> Cc: Kashyap Desai <kashyap.desai@...adcom.com>
> Cc: Sumit Saxena <sumit.saxena@...adcom.com>
> Cc: Shivasharan S <shivasharan.srikanteshwara@...adcom.com>
> Cc: "James E.J. Bottomley" <jejb@...ux.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@...cle.com>
> Cc: megaraidlinux.pdl@...adcom.com
> Cc: linux-scsi@...r.kernel.org
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> Holger, are you able to test this change? I expect it should do the
> trick, but I don't have the hardware.
>
Yes, that does work. I no longer see 'memcpy: detected field-spanning
write (size 128)'. Tested this on 6.1.4-rc1. Did not see any other
regression.
Regards,
Holger
Powered by blists - more mailing lists