* [PATCH] scsi: wd719x: initialize all fields of eeprom_93cx6 struct
@ 2026-07-24 8:17 stf_xl
0 siblings, 0 replies; only message in thread
From: stf_xl @ 2026-07-24 8:17 UTC (permalink / raw)
To: linux-scsi; +Cc: James.Bottomley, martin.petersen, linux-kernel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-24 8:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-24 8:17 [PATCH] scsi: wd719x: initialize all fields of eeprom_93cx6 struct stf_xl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®