* [PATCH][next] ipmi: ipmb: Fix off-by-one size check on rcvlen
@ 2021-10-05 15:16 Colin King
2021-10-05 15:40 ` [Openipmi-developer] " Corey Minyard
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-10-05 15:16 UTC (permalink / raw)
To: Corey Minyard, openipmi-developer; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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>
---
drivers/char/ipmi/ipmi_ipmb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
index b10a1fd9c563..77ebec4ed28e 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;
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Openipmi-developer] [PATCH][next] ipmi: ipmb: Fix off-by-one size check on rcvlen
2021-10-05 15:16 [PATCH][next] ipmi: ipmb: Fix off-by-one size check on rcvlen Colin King
@ 2021-10-05 15:40 ` Corey Minyard
0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2021-10-05 15:40 UTC (permalink / raw)
To: Colin King; +Cc: openipmi-developer, kernel-janitors, linux-kernel
On Tue, Oct 05, 2021 at 04:16:11PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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.
Got it, thanks.
-corey
>
> 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>
> ---
> drivers/char/ipmi/ipmi_ipmb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
> index b10a1fd9c563..77ebec4ed28e 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;
> --
> 2.32.0
>
>
>
> _______________________________________________
> Openipmi-developer mailing list
> Openipmi-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openipmi-developer
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-05 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 15:16 [PATCH][next] ipmi: ipmb: Fix off-by-one size check on rcvlen Colin King
2021-10-05 15:40 ` [Openipmi-developer] " Corey Minyard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).