/*
- * $Id: cmdline.c,v 1.4 2002/09/13 01:18:38 jamey Exp $
+ * $Id: cmdline.c,v 1.5 2002/11/06 22:40:04 rmk Exp $
*
* Read flash partition table from command line
*
else
{
size = memparse(s, &s);
+ if (!size)
+ {
+ printk(KERN_ERR ERRP "couldn't parse number from input string\n");
+ return 0;
+ }
if (size < PAGE_SIZE)
{
printk(KERN_ERR ERRP "partition size too small (%lx)\n", size);
/* check for offset */
if (*s == '@')
{
- s++;
- offset = memparse(s, &s);
+ s++;
+ offset = memparse(s, &s);
+ if (!offset)
+ {
+ printk(KERN_ERR ERRP "couldn't parse number from input string\n");
+ return 0;
+ }
}
/* now look for name */
if (*s == '(')
0, /* first partition */
(unsigned char**)&this_mtd, /* out: extra mem */
mtd_id_len + 1 + sizeof(*this_mtd));
+ if(!parts)
+ {
+ /*
+ * An error occurred. We're either:
+ * a) out of memory, or
+ * b) in the middle of the partition spec
+ * Either way, this mtd is hosed and we're
+ * unlikely to succeed in parsing any more
+ */
+ return 0;
+ }
/* enter results */
this_mtd->parts = parts;