Commit bf77ff6f authored by Roman Tereshonkov's avatar Roman Tereshonkov Committed by Greg Kroah-Hartman

mtdoops: fix the oops_page_used array size

commit 556f0635 upstream.

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

BITS_PER_LONG is equal to 32.
If we want to allocate memory for 32 pages with one bit per page then
32 / BITS_PER_LONG  is equal to 1 byte that is 8 bits.
To fix it we need to multiply the result by sizeof(unsigned long) equal to 4.
Signed-off-by: default avatarRoman Tereshonkov <roman.tereshonkov@nokia.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b8ed9e5b
...@@ -369,7 +369,7 @@ static void mtdoops_notify_add(struct mtd_info *mtd) ...@@ -369,7 +369,7 @@ static void mtdoops_notify_add(struct mtd_info *mtd)
/* oops_page_used is a bit field */ /* oops_page_used is a bit field */
cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages, cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages,
BITS_PER_LONG)); BITS_PER_LONG) * sizeof(unsigned long));
if (!cxt->oops_page_used) { if (!cxt->oops_page_used) {
printk(KERN_ERR "mtdoops: could not allocate page array\n"); printk(KERN_ERR "mtdoops: could not allocate page array\n");
return; return;
......
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