diff options
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index ee2b74d1d1b5..45c329694a5e 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -416,7 +416,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, } rsvd_bytes = (long long)vol->reserved_pebs * - ubi->leb_size-vol->data_pad; + vol->usable_leb_size; if (bytes < 0 || bytes > rsvd_bytes) { err = -EINVAL; break; @@ -454,7 +454,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, /* Validate the request */ err = -EINVAL; - if (req.lnum < 0 || req.lnum >= vol->reserved_pebs || + if (!ubi_leb_valid(vol, req.lnum) || req.bytes < 0 || req.bytes > vol->usable_leb_size) break; @@ -485,7 +485,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, break; } - if (lnum < 0 || lnum >= vol->reserved_pebs) { + if (!ubi_leb_valid(vol, lnum)) { err = -EINVAL; break; } |