Commit 67663d78 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

md: fix an unsigned compare to allow creation of bitmaps with v1.0 metadata

patch 85bfb4da in mainline.

As page->index is unsigned, this all becomes an unsigned comparison, which
 almost always returns an error.
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9c85df7a
...@@ -274,7 +274,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) ...@@ -274,7 +274,7 @@ static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait)
if (bitmap->offset < 0) { if (bitmap->offset < 0) {
/* DATA BITMAP METADATA */ /* DATA BITMAP METADATA */
if (bitmap->offset if (bitmap->offset
+ page->index * (PAGE_SIZE/512) + (long)(page->index * (PAGE_SIZE/512))
+ size/512 > 0) + size/512 > 0)
/* bitmap runs in to metadata */ /* bitmap runs in to metadata */
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment