Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176969
b: refs/heads/master
c: 1114e3d
h: refs/heads/master
i:
  176967: bcb5e59
v: v3
  • Loading branch information
Simon Kagstrom authored and David Woodhouse committed Nov 30, 2009
1 parent 16f1599 commit 009e619
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: be95745f01677245a061a8f51473ef5ec8ad008e
refs/heads/master: 1114e3d00f539ecb7a8415663f2a47a80e00a537
17 changes: 11 additions & 6 deletions trunk/drivers/mtd/mtdoops.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
#include <linux/interrupt.h>
#include <linux/mtd/mtd.h>

/* Maximum MTD partition size */
#define MTDOOPS_MAX_MTD_SIZE (8 * 1024 * 1024)

#define MTDOOPS_KERNMSG_MAGIC 0x5d005d00
#define OOPS_PAGE_SIZE 4096

Expand Down Expand Up @@ -310,21 +313,23 @@ static void mtdoops_notify_add(struct mtd_info *mtd)
return;
}

if (mtd->size > MTDOOPS_MAX_MTD_SIZE) {
printk(KERN_ERR "mtdoops: mtd%d is too large (limit is %d MiB)\n",
mtd->index, MTDOOPS_MAX_MTD_SIZE / 1024 / 1024);
return;
}

/* oops_page_used is a bit field */
cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages,
BITS_PER_LONG));
if (!cxt->oops_page_used) {
printk(KERN_ERR "Could not allocate page array\n");
return;
}
cxt->mtd = mtd;
if (mtd->size > INT_MAX)
cxt->oops_pages = INT_MAX / OOPS_PAGE_SIZE;
else
cxt->oops_pages = (int)mtd->size / OOPS_PAGE_SIZE;

cxt->mtd = mtd;
cxt->oops_pages = (int)mtd->size / OOPS_PAGE_SIZE;
find_next_position(cxt);

printk(KERN_INFO "mtdoops: Attached to MTD device %d\n", mtd->index);
}

Expand Down

0 comments on commit 009e619

Please sign in to comment.