[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c825b030-1520-426e-a6ad-7df0c276b3ea@gmail.com>
Date: Mon, 4 Dec 2023 07:38:13 +0100
From: Böszörményi Zoltán <zboszor@...il.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: linux-kernel@...r.kernel.org, oe-kbuild-all@...ts.linux.dev,
zboszormenyi@...om.com, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] egalax_ts_serial: Fix potential buffer overflow
2023. 12. 03. 19:35 keltezéssel, Dmitry Torokhov írta:
> Hi Zoltán,
>
> On Sun, Dec 03, 2023 at 10:06:00AM +0100, Zoltán Böszörményi wrote:
>> @@ -42,7 +42,7 @@ struct egalax {
>> struct serio *serio;
>> int idx;
>> u8 data[EGALAX_FORMAT_MAX_LENGTH];
>> - char phys[32];
>> + char phys[NAME_MAX];
> This simply wastes 200+ bytes for no good reason. It is perfectly fine
> to truncate phys string (which does not happen in practice).
Okay, I modified the phys[] array to just be 40 bytes.
That's not that wasteful and still avoids the warning.
I noticed that other TS drivers emit the same warning.
>
> If you feel strongly about it then maybe use devm_kasprintf() to
> allocate the needed buffer.
>
> Thanks.
>
Powered by blists - more mailing lists