]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/md/bitmap.c
[PATCH] md: fix calculation for size of filemap_attr array in md/bitmap
[linux-2.6-omap-h63xx.git] / drivers / md / bitmap.c
index 5554adaa58f9be01d37bc5623f63384c084e69de..e61e0efe9ec71db54a91916d978ecbda05ec1314 100644 (file)
@@ -863,9 +863,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
 
        /* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */
        bitmap->filemap_attr = kzalloc(
-               (((num_pages*4/8)+sizeof(unsigned long)-1)
-                /sizeof(unsigned long))
-               *sizeof(unsigned long),
+               roundup( DIV_ROUND_UP(num_pages*4, 8), sizeof(unsigned long)),
                GFP_KERNEL);
        if (!bitmap->filemap_attr)
                goto out;