Skip to content

Commit

Permalink
mtd: sharpslpart: Fix unsigned comparison to zero
Browse files Browse the repository at this point in the history
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: 8a4580e ("mtd: sharpslpart: Add sharpslpart partition parser")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
  • Loading branch information
YueHaibing authored and Miquel Raynal committed Jan 21, 2020
1 parent 05a5a6e commit f33113b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mtd/parsers/sharpslpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f33113b

Please sign in to comment.