[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3hii36exlwshxkpruwp5sdodsqredlfhac2447mgqiivcmfva3@4hgo7k56ejpf>
Date: Wed, 7 Jan 2026 18:37:41 +0100
From: Benjamin Tissoires <bentiss@...nel.org>
To: kenkinming2002@...il.com
Cc: jikos@...nel.org, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] HID: i2c-hid: fix potential buffer overflow in
i2c_hid_get_report()
On Jan 08 2026, kenkinming2002@...il.com wrote:
> On Wed, Jan 07, 2026 at 03:20:13PM +0100, Benjamin Tissoires wrote:
> > It makes sense to put this min call here, but it's already present at
> > line 304 a few lines after. Could you remove that second check (and
> > unnecessary one after your change).
>
> The min call at line 304 uses ret_count which comes from the first 2
> bytes in the device response and indicates the actual size of the
> returned report descriptor. Notice that importantly ret_count can be
> strictly smaller than ihid->bufsize because persumably not all reports
> have the same size. The behavior will change if the caller provides a
> larger buffer than is necessary. With the min call at line 304, we will
> return the actual size of the report descriptor (without the 2 bytes
> length header). Without the min call at 304, we will instead return the
> size of supplied buffer.
Oh, you're correct. Thanks.
Applied (as mentioned by the automated reply).
Cheers,
Benjamin
>
> Yours sincerely,
> Ken Kwok
Powered by blists - more mailing lists