From: stf_xl@wp.pl
To: linux-scsi@vger.kernel.org
Cc: James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com, linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: wd719x: initialize all fields of eeprom_93cx6 struct
Date: Fri, 24 Jul 2026 10:17:47 +0200 [thread overview]
Message-ID: <20260724081747.7726-1-stf_xl@wp.pl> (raw)
From: Stanislaw Gruszka <stf_xl@wp.pl>
Commit 7738a7ab9d12 ("misc: eeprom: eeprom_93cx6: Add quirk for extra
read clock cycle") added extra 'quirk' field to struct eeprom_93cx6,
which change how the data is read.
Some existing users of eeprom_93cx6, including wd719x driver, allocate
the structure on the stack without initialization of all the fields.
As a result, the added quirk field has undefined value, what can
randomly cause reading wrong data from the EEPROM.
Fix by using designated initialization.
Fixes: 7738a7ab9d12 ("misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle")
Cc: stable@kernel.org # v6.13+
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
---
drivers/scsi/wd719x.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 830d40f57f6a..2bdfb2c759ed 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -739,15 +739,15 @@ static void wd719x_eeprom_reg_write(struct eeprom_93cx6 *eeprom)
/* read config from EEPROM so it can be downloaded by the RISC on (re-)init */
static void wd719x_read_eeprom(struct wd719x *wd)
{
- struct eeprom_93cx6 eeprom;
+ struct eeprom_93cx6 eeprom = {
+ .data = wd,
+ .register_read = wd719x_eeprom_reg_read,
+ .register_write = wd719x_eeprom_reg_write,
+ .width = PCI_EEPROM_WIDTH_93C46,
+ };
u8 gpio;
struct wd719x_eeprom_header header;
- eeprom.data = wd;
- eeprom.register_read = wd719x_eeprom_reg_read;
- eeprom.register_write = wd719x_eeprom_reg_write;
- eeprom.width = PCI_EEPROM_WIDTH_93C46;
-
/* set all outputs to low */
wd719x_writeb(wd, WD719X_PCI_GPIO_DATA, 0);
/* configure GPIO pins */
--
2.50.1
next reply other threads:[~2026-07-24 8:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 8:17 stf_xl [this message]
2026-07-24 8:27 ` [PATCH] scsi: wd719x: initialize all fields of eeprom_93cx6 struct sashiko-bot
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=20260724081747.7726-1-stf_xl@wp.pl \
--to=stf_xl@wp.pl \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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