>From stable-bounces@linux.kernel.org Mon Oct 22 20:45:35 2007 From: akpm@linux-foundation.org Date: Mon, 22 Oct 2007 20:45:11 -0700 Subject: md: fix an unsigned compare to allow creation of bitmaps with v1.0 metadata To: torvalds@linux-foundation.org Cc: neilb@suse.de, akpm@linux-foundation.org, stable@kernel.org Message-ID: <200710230345.l9N3jB65030288@imap1.linux-foundation.org> From: NeilBrown patch 85bfb4da8cad483a4e550ec89060d05a4daf895b in mainline. As page->index is unsigned, this all becomes an unsigned comparison, which almost always returns an error. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/md/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -274,7 +274,7 @@ static int write_sb_page(struct bitmap * 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;