aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/sm_common.c
diff options
context:
space:
mode:
authorMichał Kępień <kernel@kempniu.pl>2022-06-29 14:57:35 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2022-09-21 10:38:07 +0200
commit745df17906029cc683b8b5ac8bcb08f82860baff (patch)
tree7880199cc6c84d6715d0b6979fe7bdf5cc8cc576 /drivers/mtd/nand/raw/sm_common.c
parentmtd: track maximum number of bitflips for each read request (diff)
downloadlinux-dev-745df17906029cc683b8b5ac8bcb08f82860baff.tar.xz
linux-dev-745df17906029cc683b8b5ac8bcb08f82860baff.zip
mtd: always initialize 'stats' in struct mtd_oob_ops
As the 'stats' field in struct mtd_oob_ops is used in conditional expressions, ensure it is always zero-initialized in all such structures to prevent random stack garbage from being interpreted as a pointer. Strictly speaking, this problem currently only needs to be fixed for struct mtd_oob_ops structures subsequently passed to mtd_read_oob(). However, this commit goes a step further and makes all instances of struct mtd_oob_ops in the tree zero-initialized, in hope of preventing future problems, e.g. if struct mtd_req_stats gets extended with write statistics at some point. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220629125737.14418-3-kernel@kempniu.pl
Diffstat (limited to 'drivers/mtd/nand/raw/sm_common.c')
-rw-r--r--drivers/mtd/nand/raw/sm_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/sm_common.c b/drivers/mtd/nand/raw/sm_common.c
index b2b42dd1a2de..24f52a30fb13 100644
--- a/drivers/mtd/nand/raw/sm_common.c
+++ b/drivers/mtd/nand/raw/sm_common.c
@@ -99,7 +99,7 @@ static const struct mtd_ooblayout_ops oob_sm_small_ops = {
static int sm_block_markbad(struct nand_chip *chip, loff_t ofs)
{
struct mtd_info *mtd = nand_to_mtd(chip);
- struct mtd_oob_ops ops;
+ struct mtd_oob_ops ops = { };
struct sm_oob oob;
int ret;