Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-07 Thread Greg Kroah-Hartman
On Sat, Aug 29, 2020 at 05:43:58PM -0700, Joe Perches wrote: > On Sat, 2020-08-29 at 16:48 -0700, Joe Perches wrote: > > Output defects can exist in sysfs content using sprintf and snprintf. > > > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > > used for outputting sysfs c

Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-06 Thread Greg Kroah-Hartman
On Sun, Sep 06, 2020 at 10:24:20AM -0700, Joe Perches wrote: > On Sat, 2020-08-29 at 16:48 -0700, Joe Perches wrote: > > Output defects can exist in sysfs content using sprintf and snprintf. > > > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > > used for outputting sysfs c

Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-09-06 Thread Joe Perches
On Sat, 2020-08-29 at 16:48 -0700, Joe Perches wrote: > Output defects can exist in sysfs content using sprintf and snprintf. > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > used for outputting sysfs content and it's possible to overrun the > PAGE_SIZE buffer length. > >

Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-08-30 Thread Joe Perches
On Sun, 2020-08-30 at 18:25 +0300, Denis Efremov wrote: > > On 8/30/20 3:43 AM, Joe Perches wrote: > > $ cat sysfs_emit.cocci > > @@ > > identifier d_show =~ "^.*show.*$"; > > I think this additional pattern will allow to take more functions into the > scope. > > @da@ > identifier show, store;

Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-08-30 Thread Denis Efremov
On 8/30/20 3:43 AM, Joe Perches wrote: > $ cat sysfs_emit.cocci > @@ > identifier d_show =~ "^.*show.*$"; I think this additional pattern will allow to take more functions into the scope. @da@ identifier show, store; expression name, mode; @@ ( DEVICE_ATTR(name, mode, show, store) | DE

Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-08-30 Thread Julia Lawall
On Sat, 29 Aug 2020, Joe Perches wrote: > On Sat, 2020-08-29 at 16:48 -0700, Joe Perches wrote: > > Output defects can exist in sysfs content using sprintf and snprintf. > > > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > > used for outputting sysfs content and it's po

Re: [PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-08-29 Thread Joe Perches
On Sat, 2020-08-29 at 16:48 -0700, Joe Perches wrote: > Output defects can exist in sysfs content using sprintf and snprintf. > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > used for outputting sysfs content and it's possible to overrun the > PAGE_SIZE buffer length. > >

[PATCH V2] sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output

2020-08-29 Thread Joe Perches
Output defects can exist in sysfs content using sprintf and snprintf. sprintf does not know the PAGE_SIZE maximum of the temporary buffer used for outputting sysfs content and it's possible to overrun the PAGE_SIZE buffer length. Add a generic sysfs_emit function that knows that the size of the t