diff options
author | YueHaibing <yuehaibing@huawei.com> | 2019-12-30 11:29:45 +0800 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2020-01-21 20:00:34 +0100 |
commit | f33113b542219448fa02d77ca1c6f4265bd7f130 (patch) | |
tree | f91752cec049cae48bf7226ebbdd7e460dded248 /drivers/mtd | |
parent | 05a5a6e57e6aebdab588d47acc8643e566c170fa (diff) | |
download | linux-f33113b542219448fa02d77ca1c6f4265bd7f130.tar.bz2 |
mtd: sharpslpart: Fix unsigned comparison to zero
The unsigned variable log_num is being assigned a return value
from the call to sharpsl_nand_get_logical_num that can return
-EINVAL.
Detected using Coccinelle:
./drivers/mtd/parsers/sharpslpart.c:207:6-13: WARNING: Unsigned expression compared with zero: log_num > 0
Fixes: 8a4580e4d298 ("mtd: sharpslpart: Add sharpslpart partition parser")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/parsers/sharpslpart.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/parsers/sharpslpart.c b/drivers/mtd/parsers/sharpslpart.c index e5ea6127ab5a..671a61845bd5 100644 --- a/drivers/mtd/parsers/sharpslpart.c +++ b/drivers/mtd/parsers/sharpslpart.c @@ -165,10 +165,10 @@ static int sharpsl_nand_get_logical_num(u8 *oob) static int sharpsl_nand_init_ftl(struct mtd_info *mtd, struct sharpsl_ftl *ftl) { - unsigned int block_num, log_num, phymax; + unsigned int block_num, phymax; + int i, ret, log_num; loff_t block_adr; u8 *oob; - int i, ret; oob = kzalloc(mtd->oobsize, GFP_KERNEL); if (!oob) |