diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-01 12:48:28 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-01 12:48:28 +0100 |
commit | 645af4e9e0e32481e3336dda813688732c7e5f0f (patch) | |
tree | 931b31f3b6e0879df0f9a1d58ffd040d9a652f2e /drivers/mtd/devices/slram.c | |
parent | ecc25fbd6b9e07b33895c61ddf84006b00f55d99 (diff) | |
parent | 55f2b78995826d549401bdf20abeac1832636bb6 (diff) |
Merge branch 'x86/pat' into x86/core
Diffstat (limited to 'drivers/mtd/devices/slram.c')
-rw-r--r-- | drivers/mtd/devices/slram.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index a425d09f35a..00248e81ecd 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c @@ -267,22 +267,28 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) if (*(szlength) != '+') { devlength = simple_strtoul(szlength, &buffer, 0); devlength = handle_unit(devlength, buffer) - devstart; + if (devlength < devstart) + goto err_out; + + devlength -= devstart; } else { devlength = simple_strtoul(szlength + 1, &buffer, 0); devlength = handle_unit(devlength, buffer); } T("slram: devname=%s, devstart=0x%lx, devlength=0x%lx\n", devname, devstart, devlength); - if ((devstart < 0) || (devlength < 0) || (devlength % SLRAM_BLK_SZ != 0)) { - E("slram: Illegal start / length parameter.\n"); - return(-EINVAL); - } + if (devlength % SLRAM_BLK_SZ != 0) + goto err_out; if ((devstart = register_device(devname, devstart, devlength))){ unregister_devices(); return((int)devstart); } return(0); + +err_out: + E("slram: Illegal length parameter.\n"); + return(-EINVAL); } #ifndef MODULE |