Skip to content

Commit 70a71f8

Browse files
Ivan Stepchenkomiquelraynal
authored andcommitted
mtd: onenand: Fix uninitialized retlen in do_otp_read()
The function do_otp_read() does not set the output parameter *retlen, which is expected to contain the number of bytes actually read. As a result, in onenand_otp_walk(), the tmp_retlen variable remains uninitialized after calling do_otp_walk() and used to change the values of the buf, len and retlen variables. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 49dc08e ("[MTD] [OneNAND] fix numerous races") Cc: [email protected] Signed-off-by: Ivan Stepchenko <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent ae461cd commit 70a71f8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/mtd/nand/onenand/onenand_base.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,6 +2923,7 @@ static int do_otp_read(struct mtd_info *mtd, loff_t from, size_t len,
29232923
ret = ONENAND_IS_4KB_PAGE(this) ?
29242924
onenand_mlc_read_ops_nolock(mtd, from, &ops) :
29252925
onenand_read_ops_nolock(mtd, from, &ops);
2926+
*retlen = ops.retlen;
29262927

29272928
/* Exit OTP access mode */
29282929
this->command(mtd, ONENAND_CMD_RESET, 0, 0);

0 commit comments

Comments
 (0)