Initialise local struct spi_mem_op with all zeros at declaration, or by memset before the second use, in order to avoid using garbage data for fields that are not explicitly set afterwards. Fixes: ad624dfd7bb6 ("mtd: spi-nor: micron-st: allow using MT35XU512ABA in Octal DTR mode") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxx> --- drivers/mtd/spi-nor/micron-st.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c index f79e71d99124..8390ed6a47b6 100644 --- a/drivers/mtd/spi-nor/micron-st.c +++ b/drivers/mtd/spi-nor/micron-st.c @@ -49,7 +49,7 @@ static int micron_st_nor_octal_dtr_en(struct spi_nor *nor) { - struct spi_mem_op op; + struct spi_mem_op op = {}; u8 *buf = nor->bouncebuf; int ret; u8 addr_mode_nbytes = nor->params->addr_mode_nbytes; @@ -64,6 +64,7 @@ static int micron_st_nor_octal_dtr_en(struct spi_nor *nor) return ret; buf[0] = SPINOR_MT_OCT_DTR; + memset(&op, 0, sizeof(op)); op = (struct spi_mem_op) MICRON_ST_NOR_WR_ANY_REG_OP(addr_mode_nbytes, SPINOR_REG_MT_CFR0V, 1, buf); @@ -86,7 +87,7 @@ static int micron_st_nor_octal_dtr_en(struct spi_nor *nor) static int micron_st_nor_octal_dtr_dis(struct spi_nor *nor) { - struct spi_mem_op op; + struct spi_mem_op op = {}; u8 *buf = nor->bouncebuf; int ret; -- 2.34.1