logfs: signedness issue in mtd_find_last_sb()
PATCH 1/1 logfs: signedness issue in mtd_find_last_sb()
"*ofs" is unsigned here so it's never less than zero.
Signed-off-by Dan Carpenter <[email protected]>
---
This was found by a static checker and I have only compile tested it. Sorry about that.
fs/logfs/dev_mtd.c +2 -2
@@ -175,9 +175,9 @@ static struct page *mtd_find_last_sb(struct super_block *sb, u64 *ofs) *ofs = mtd->size - mtd->erasesize;while (mtd->block_isbad (mtd, *ofs)) { - *ofs -= mtd->erasesize; -if (*ofs <=0 ) +if (*ofs <= mtd->erasesize)return NULL ; + *ofs -= mtd->erasesize; } *ofs = *ofs + mtd->erasesize -0x1000 ;BUG_ON (*ofs & ~PAGE_MASK );