[PATCH] mtdoops: fix the oops_page_used array size

Roman Tereshonkov roman.tereshonkov at nokia.com
Tue Nov 29 05:49:18 EST 2011


The array of unsigned long pointed by oops_page_used is allocated
by vmalloc which requires the size to be in bytes.

Signed-off-by: Roman Tereshonkov <roman.tereshonkov at nokia.com>
---
 drivers/mtd/mtdoops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 1e2fa62..0782b31 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -369,7 +369,7 @@ static void mtdoops_notify_add(struct mtd_info *mtd)
 
 	/* oops_page_used is a bit field */
 	cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages,
-			BITS_PER_LONG));
+			BITS_PER_LONG) * sizeof(unsigned long));
 	if (!cxt->oops_page_used) {
 		printk(KERN_ERR "mtdoops: could not allocate page array\n");
 		return;
-- 
1.7.0.4




More information about the linux-mtd mailing list