Re: [PATCH v4 3/5] HID: asus: fix a off-by-one issue making a check stricter that it needs to be

From: Antheas Kapenekakis

Date: Mon Jun 15 2026 - 17:45:11 EST


On Mon, 15 Jun 2026 at 18:51, Denis Benato <denis.benato@xxxxxxxxx> wrote:
>
> In mcu_parse_version_string() a size validation for response is stricter
> that it needs to be: relax the check by one byte.

"making a check stricter that it needs to be"

what check, you might need to reword the title

> Fixes: ("hid-asus: check ROG Ally MCU version and warn")
> Signed-off-by: Denis Benato <denis.benato@xxxxxxxxx>
> ---
> drivers/hid/hid-asus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index bbf964b12c16..6896730efafc 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
> @@ -835,7 +835,7 @@ static int mcu_parse_version_string(const u8 *response, size_t response_size)
> dots++;
> }
>
> - if (dots != 2 || p >= end || (p + 3) >= end)
> + if (dots != 2 || end - p < 3)
> return -EINVAL;
>
> memcpy(buf, p, 3);
> --
> 2.47.3
>
>