Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: 007 <zxl434815272@gmail.com>
To: Maxwell Doose <m32285159@gmail.com>
Cc: linux-gpio@vger.kernel.org, brgl@kernel.org,
	warthog618@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] tools: gpio: validate arguments in gpiotools_request_line
Date: Thu, 7 May 2026 08:04:48 +0800	[thread overview]
Message-ID: <5ee7815e-a858-4359-881e-cf1b47242d0b@gmail.com> (raw)
In-Reply-To: <CAKqfh0H7BzdxYJr3bQbymrh9ex4q7fLcCbGEkp3HPX++pJ-XMg@mail.gmail.com>

OK, I will redo it, thanks.

Best regards,

Zhang Xiaolei

On 5/5/26 00:13, Maxwell Doose wrote:
> On Mon, May 4, 2026 at 2:56 AM Zhang Xiaolei <zxl434815272@gmail.com> wrote:
>> Add validation for input pointers and number of lines.
>>
> Perhaps make the commit message more descriptive?
>
>> Signed-off-by: Zhang Xiaolei <zxl434815272@gmail.com>
>> ---
>>   tools/gpio/gpio-utils.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/tools/gpio/gpio-utils.c b/tools/gpio/gpio-utils.c
>> index 176bccfcccb0..930a38fe7911 100644
>> --- a/tools/gpio/gpio-utils.c
>> +++ b/tools/gpio/gpio-utils.c
>> @@ -65,6 +65,12 @@ int gpiotools_request_line(const char *device_name, unsigned int *lines,
>>          int i;
>>          int ret;
>>
>> +       if (!device_name || !lines || !config || !consumer || !num_lines)
>> +               return -EINVAL;
>> +
>> +       if (num_lines > GPIO_V2_LINES_MAX)
>> +               return -EINVAL;
>> +
> I'm wondering if we might want to use ERANGE here for the num_lines >
> GPIO_V2_LINES_MAX check instead of EINVAL.
>
> best regards,
> maxwell

  reply	other threads:[~2026-05-07  0:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03 19:00 [PATCH] tools: gpio: fix buffer overflow and add bounds check Zhang Xiaolei
2026-05-03 20:56 ` Maxwell Doose
2026-05-04  5:46   ` 007
2026-05-04  5:55   ` 007
2026-05-04  7:50 ` [PATCH v2 1/3] tools: gpio: use strscpy() for consumer name Zhang Xiaolei
2026-05-04  7:50   ` [PATCH v2 2/3] tools: gpio: validate arguments in gpiotools_request_line Zhang Xiaolei
2026-05-04 16:13     ` Maxwell Doose
2026-05-07  0:04       ` 007 [this message]
2026-05-04  7:50   ` [PATCH v2 3/3] tools: gpio: fix ioctl name in error message Zhang Xiaolei
2026-05-04 17:47     ` Maxwell Doose
2026-05-07  0:03       ` 007
2026-05-07  0:41     ` [PATCH v3] " Zhang Xiaolei
2026-05-04 12:45   ` [PATCH v2 1/3] tools: gpio: use strscpy() for consumer name David Laight
2026-05-07  0:02     ` 007

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=5ee7815e-a858-4359-881e-cf1b47242d0b@gmail.com \
    --to=zxl434815272@gmail.com \
    --cc=brgl@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m32285159@gmail.com \
    --cc=warthog618@gmail.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