From aa2cd910c7465eaf6de04da1b4d110205ad63c77 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Tue, 2 Jun 2020 10:54:12 +0200 Subject: mtd: nand: base: fix use of uninitialized struct member ooblen is read in nand_do_read_ops, despite never having been assigned a value. Because ooblen is used to indicate how many bytes of oobbuf are usable and oobbuf is NULL, use 0 as initial value. Found on ARCH=sandbox using clang-analyzer. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- drivers/mtd/nand/nand_base.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 00f0f75884..3f4c787f49 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1688,6 +1688,7 @@ static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, nand_get_device(mtd, FL_READING); ops.len = len; ops.datbuf = buf; + ops.ooblen = 0; ops.oobbuf = NULL; ops.mode = MTD_OPS_PLACE_OOB; ret = nand_do_read_ops(mtd, from, &ops); -- cgit v1.2.3