Re: [PATCH] gpiolib: cdev: add fdinfo output for line request file descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx> 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





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux