mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Böszörményi Zoltán" <zboszor@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, oe-kbuild-all@lists.linux.dev,
	zboszormenyi@sicom.com, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] egalax_ts_serial: Fix potential buffer overflow
Date: Mon, 4 Dec 2023 07:38:13 +0100	[thread overview]
Message-ID: <c825b030-1520-426e-a6ad-7df0c276b3ea@gmail.com> (raw)
In-Reply-To: <ZWzHv7X1UKgJJYTy@google.com>

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


  reply	other threads:[~2023-12-04  6:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03  6:07 drivers/input/touchscreen/egalax_ts_serial.c:116:21: warning: '/input0' directive output may be truncated writing 7 bytes into a region of size between 1 and 32 kernel test robot
2023-12-03  6:23 ` Dmitry Torokhov
2023-12-03  9:06 ` [PATCH] egalax_ts_serial: Fix potential buffer overflow Zoltán Böszörményi
2023-12-03 18:35   ` Dmitry Torokhov
2023-12-04  6:38     ` Böszörményi Zoltán [this message]
2023-12-04  6:40       ` [PATCH v2] " Zoltán Böszörményi
  -- strict thread matches above, loose matches on Subject: below --
2023-11-17 12:43 [PATCH] " Zoltán Böszörményi
2023-11-17  9:43 drivers/input/touchscreen/egalax_ts_serial.c:116:21: warning: '/input0' directive output may be truncated writing 7 bytes into a region of size between 1 and 32 kernel test robot
2023-12-03  9:05 ` [PATCH] egalax_ts_serial: Fix potential buffer overflow Zoltán Böszörményi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c825b030-1520-426e-a6ad-7df0c276b3ea@gmail.com \
    --to=zboszor@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=zboszormenyi@sicom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®