From: Chris Leech <cleech@redhat.com>
To: linux-scsi@vger.kernel.org, Nilesh Javali <njavali@marvell.com>
Cc: Kees Cook <kees@kernel.org>,
"Gustavo A . R . Silva" <gustavoars@kernel.org>,
Bryan Gurney <bgurney@redhat.com>,
John Meneghini <jmeneghi@redhat.com>
Subject: [PATCH 1/2] scsi: qla2xxx: replace non-standard flexible array purex_item.iocb
Date: Fri, 25 Jul 2025 14:27:31 -0700 [thread overview]
Message-ID: <20250725212732.2038027-2-cleech@redhat.com> (raw)
In-Reply-To: <20250725212732.2038027-1-cleech@redhat.com>
This is defined as a 64-element u8 array, but 64 is the minimum size and
it can be allocated larger. I don't know why the array was wrapped as a
single element struct of the same name.
Replace with a union around DECLARE_FLEX_ARRAY and padding to maintain
sizeof(struct purex_item) and associated use.
This was triggering a field-spanning write warning during FPIN testing
https://lore.kernel.org/linux-nvme/20250709211919.49100-1-bgurney@redhat.com/
> kernel: memcpy: detected field-spanning write (size 60) of single field
> "((uint8_t *)fpin_pkt + buffer_copy_offset)"
> at drivers/scsi/qla2xxx/qla_isr.c:1221 (size 44)
Tested-by: Bryan Gurney <bgurney@redhat.com>
Signed-off-by: Chris Leech <cleech@redhat.com>
---
drivers/scsi/qla2xxx/qla_def.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index cb95b7b12051d..6237fefeca149 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -4890,8 +4890,9 @@ struct purex_item {
struct purex_item *pkt);
atomic_t in_use;
uint16_t size;
- struct {
- uint8_t iocb[64];
+ union {
+ uint8_t __padding[QLA_DEFAULT_PAYLOAD_SIZE];
+ DECLARE_FLEX_ARRAY(uint8_t, iocb);
} iocb;
};
--
2.50.1
next prev parent reply other threads:[~2025-07-25 21:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 21:27 [PATCH 0/2] scsi: qla2xxx: flexible array / field-spanning write issue Chris Leech
2025-07-25 21:27 ` Chris Leech [this message]
2025-07-25 21:54 ` [PATCH 1/2] scsi: qla2xxx: replace non-standard flexible array purex_item.iocb Kees Cook
2025-07-28 18:57 ` [PATCH v2 1/1] " Chris Leech
2025-07-28 19:43 ` Gustavo A. R. Silva
2025-07-28 19:54 ` Gustavo A. R. Silva
2025-07-28 21:15 ` Chris Leech
2025-07-28 22:55 ` Gustavo A. R. Silva
2025-07-28 23:52 ` Chris Leech
2025-07-29 1:37 ` Gustavo A. R. Silva
2025-07-29 2:20 ` Gustavo A. R. Silva
2025-07-30 0:04 ` Chris Leech
2025-07-30 1:33 ` Gustavo A. R. Silva
2025-07-30 3:44 ` Gustavo A. R. Silva
2025-07-30 15:43 ` Bryan Gurney
2025-07-30 20:55 ` Gustavo A. R. Silva
2025-07-25 21:27 ` [PATCH 2/2] scsi: qla2xxx: unwrap purex_item.iocb.iocb so that __counted_by can be used Chris Leech
2025-07-25 21:56 ` Kees Cook
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=20250725212732.2038027-2-cleech@redhat.com \
--to=cleech@redhat.com \
--cc=bgurney@redhat.com \
--cc=gustavoars@kernel.org \
--cc=jmeneghi@redhat.com \
--cc=kees@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=njavali@marvell.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