提交 2a3dce6d 编写于 作者: Y YueHaibing 提交者: Yang Yingliang

mtd: sharpslpart: Fix unsigned comparison to zero

commit f33113b5 upstream.

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: 8a4580e4 ("mtd: sharpslpart: Add sharpslpart partition parser")
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 05ede18f
...@@ -165,10 +165,10 @@ static int sharpsl_nand_get_logical_num(u8 *oob) ...@@ -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) 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; loff_t block_adr;
u8 *oob; u8 *oob;
int i, ret;
oob = kzalloc(mtd->oobsize, GFP_KERNEL); oob = kzalloc(mtd->oobsize, GFP_KERNEL);
if (!oob) if (!oob)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册