Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4ab60a0d7c92cab16f7e470f80ea039a0b174bce Commit: 4ab60a0d7c92cab16f7e470f80ea039a0b174bce Parent: 78d87c95b89ccf86c142494beada3082810ed368 Author: Artem Bityutskiy <[EMAIL PROTECTED]> AuthorDate: Sat May 5 14:59:23 2007 +0300 Committer: Artem Bityutskiy <[EMAIL PROTECTED]> CommitDate: Wed Jul 18 16:52:42 2007 +0300
UBI: do not let to read too much In case of static volumes it is prohibited to read more data then available. Signed-off-by: Artem Bityutskiy <[EMAIL PROTECTED]> --- drivers/mtd/ubi/kapi.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index d352c45..14c66b4 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c @@ -319,9 +319,14 @@ int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, offset + len > vol->usable_leb_size) return -EINVAL; - if (vol->vol_type == UBI_STATIC_VOLUME && lnum == vol->used_ebs - 1 && - offset + len > vol->last_eb_bytes) - return -EINVAL; + if (vol->vol_type == UBI_STATIC_VOLUME) { + if (vol->used_ebs == 0) + /* Empty static UBI volume */ + return 0; + if (lnum == vol->used_ebs - 1 && + offset + len > vol->last_eb_bytes) + return -EINVAL; + } if (vol->upd_marker) return -EBADF; - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html