public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpiolib: cdev: add fdinfo output for line request file descriptors
Date: Wed, 21 Sep 2022 17:44:08 +0300	[thread overview]
Message-ID: <YysjOJpsZkpdDx7W@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=McjOhUBa0QQbZYh0f_2rN=ESxAtPROAzXEt+KNDJKqWiQ@mail.gmail.com>

On Tue, Sep 20, 2022 at 10:35:25PM +0200, Bartosz Golaszewski wrote:
> On Tue, Sep 20, 2022 at 7:19 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, Sep 20, 2022 at 03:54:35PM +0200, Bartosz Golaszewski wrote:

...

> > > +     seq_printf(out, "gpio-device:\t%s\n", dev_name(dev));
> > > +
> > > +     for (i = 0; i < lr->num_lines; i++)
> > > +             seq_printf(out, "gpio-line:\t%d\n",
> > > +                        gpio_chip_hwgpio(lr->lines[i].desc));
> >
> > Hmm... Not sure which variant is better (as for machine parsing and for human),
> > but I was thinking of
> 
> IMO it's pretty clear that the variant in this patch is easier for
> machine parsing - one less tokenization.

For human it's harder in my opinion... But okay.

> >         gpio-lines: 1,4,6, ...
> >
> > Also don't forget that sizes over PAGE_SIZE in sysfs sometimes problematic and
> > racy.(the commit 888be6067b97 ("ACPI: sysfs: Fix a buffer overrun problem with
> > description_show()") for the reference).
> 
> In most systems PAGE_SIZE will be at least 4096 bytes. With this patch
> a single "gpio-line:\t65535\n" is at most 17 bytes long x max 64 lines
> = 1088 bytes. We're still way below the size where it would be
> problematic.

Okay, for now it's 64, but it will be problematic starting from ~300 requested
lines. Also, in case we add something more, who knows?

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2022-09-21 14:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 13:54 [PATCH] gpiolib: cdev: add fdinfo output for line request file descriptors Bartosz Golaszewski
2022-09-20 14:22 ` Kent Gibson
2022-09-20 17:19 ` Andy Shevchenko
2022-09-20 17:29   ` Andy Shevchenko
2022-09-20 17:47     ` Andy Shevchenko
2022-09-20 20:35   ` Bartosz Golaszewski
2022-09-21 14:44     ` Andy Shevchenko [this message]

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=YysjOJpsZkpdDx7W@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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