]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
md: fix an unsigned compare to allow creation of bitmaps with v1.0 metadata
authorNeilBrown <neilb@suse.de>
Tue, 23 Oct 2007 03:45:11 +0000 (20:45 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 23 Oct 2007 15:32:06 +0000 (08:32 -0700)
As page->index is unsigned, this all becomes an unsigned comparison,
which almost always returns an error.

Signed-off-by: Neil Brown <neilb@suse.de>
Cc: Stable <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/bitmap.c

index 927cb34c480584d75803d8eb826db7e8f4a45c83..7c426d07a555c0426855571552289c6ed9fcaaaa 100644 (file)
@@ -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;