Commit:     505fa2c4a2f125a70951926dfb22b9cf273994f1
Parent:     b6550777a32f7204f87475beb4f40d054fb8d4b4
Author:     Neil Brown <[EMAIL PROTECTED]>
AuthorDate: Wed Apr 11 23:28:44 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Apr 12 15:31:42 2007 -0700

    [PATCH] md: fix calculation for size of filemap_attr array in md/bitmap
    If 'num_pages' were ever 1 more than a multiple of 8 (32bit platforms)
    or of 16 (64 bit platforms).  filemap_attr would be allocated one
    'unsigned long' shorter than required.  We need a round-up in there.
    Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 drivers/md/bitmap.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 5554ada..e61e0ef 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -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)),
        if (!bitmap->filemap_attr)
                goto out;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to