Re: [PATCH] egalax_ts_serial: Fix potential buffer overflow

From: Dmitry Torokhov
Date: Sun Dec 03 2023 - 13:35:24 EST


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).

If you feel strongly about it then maybe use devm_kasprintf() to
allocate the needed buffer.

Thanks.

--
Dmitry