summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-10-05 16:16:11 +0100
committerCorey Minyard <cminyard@mvista.com>2021-10-05 10:39:37 -0500
commit39ce73504695500e043d2851e3d4938fcae89399 (patch)
tree51a30c9c426a49d46cd5a3ff9d3c35b454d1bc39 /drivers/char
parent8332cd4936ed93df42add6541f740ce937e7a5bc (diff)
ipmi: ipmb: Fix off-by-one size check on rcvlen
There is an off-by-one bounds check on the rcvlen causing a potential out of bounds write on iidev->rcvmsg. Fix this by using the >= operator on the bounds check rather than the > operator. Addresses-Coverity: ("Out-of-bounds write") Fixes: 0ba0c3c5d1c1 ("ipmi:ipmb: Add initial support for IPMI over IPMB") Signed-off-by: Colin Ian King <colin.king@canonical.com> Message-Id: <20211005151611.305383-1-colin.king@canonical.com> Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/ipmi/ipmi_ipmb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
index 742ae10166af..856e432fa04c 100644
--- a/drivers/char/ipmi/ipmi_ipmb.c
+++ b/drivers/char/ipmi/ipmi_ipmb.c
@@ -192,7 +192,7 @@ static int ipmi_ipmb_slave_cb(struct i2c_client *client,
break;
case I2C_SLAVE_WRITE_RECEIVED:
- if (iidev->rcvlen > sizeof(iidev->rcvmsg))
+ if (iidev->rcvlen >= sizeof(iidev->rcvmsg))
iidev->overrun = true;
else
iidev->rcvmsg[iidev->rcvlen++] = *val;