Message ID | 49AE9BD5.8000107@gmail.com |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 529af27..1219a18 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -2296,11 +2296,11 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, if (!action) { /* OTP Info functions */ struct otp_info *otpinfo; - len -= sizeof(struct otp_info); - if (len <= 0) { + if (len <= sizeof(struct otp_info)) { ret = -ENOSPC; break; } + len -= sizeof(struct otp_info); otpinfo = (struct otp_info *) buf; otpinfo->start = from;