From: NeilBrown Date: Tue, 23 Oct 2007 03:45:11 +0000 (-0700) Subject: md: fix an unsigned compare to allow creation of bitmaps with v1.0 metadata X-Git-Tag: v2.6.24-rc1~53 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85bfb4da8cad483a4e550ec89060d05a4daf895b;p=linux-2.6 md: fix an unsigned compare to allow creation of bitmaps with v1.0 metadata As page->index is unsigned, this all becomes an unsigned comparison, which almost always returns an error. Signed-off-by: Neil Brown Cc: Stable Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 927cb34c48..7c426d07a5 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -274,7 +274,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) if (bitmap->offset < 0) { /* DATA BITMAP METADATA */ if (bitmap->offset - + page->index * (PAGE_SIZE/512) + + (long)(page->index * (PAGE_SIZE/512)) + size/512 > 0) /* bitmap runs in to metadata */ return -EINVAL;