* [patch] logfs: signedness issue in mtd_find_last_sb()
@ 2010-09-10 19:33 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-09-10 19:33 UTC (permalink / raw)
To: kernel-janitors
"*ofs" is unsigned here so it's never less than zero.
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
This was found by a static checker and I have only compile tested it.
Sorry about that.
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index a85d47d..99b3d4c 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -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);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-10 19:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-10 19:33 [patch] logfs: signedness issue in mtd_find_last_sb() Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox