Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Joe Perches
On Sun, 2020-08-30 at 00:53 +0300, Denis Efremov wrote: > > Anyway, this will need updating, likely with better examples. [] > I think it's good to reflect in docs that sysfs_emit_at/sysfs_emit_pos is > only for "legacy" code and should not be used in new code (checkpatch.pl > warning?) > because

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Denis Efremov
> > Anyway, this will need updating, likely with better examples. > > diff --git a/Documentation/filesystems/sysfs.rst > b/Documentation/filesystems/sysfs.rst > index ab0f7795792b..13c7a86fa6c8 100644 > --- a/Documentation/filesystems/sysfs.rst > +++ b/Documentation/filesystems/sysfs.rst > @@

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Joe Perches
On Sat, 2020-08-29 at 09:59 +0300, Denis Efremov wrote: > Hi, > > On 8/29/20 1:52 AM, Joe Perches wrote: > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > > used for outputting sysfs content requests and it's possible to > > overrun the buffer length. > > > > Add a

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Denis Efremov
Hi, On 8/29/20 1:52 AM, Joe Perches wrote: > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > used for outputting sysfs content requests and it's possible to > overrun the buffer length. > > Add a generic sysfs_emit mechanism that knows that the size of the > temporary

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Greg Kroah-Hartman
On Fri, Aug 28, 2020 at 11:41:00PM -0700, Joe Perches wrote: > On Sat, 2020-08-29 at 08:22 +0200, Greg Kroah-Hartman wrote: > > On Fri, Aug 28, 2020 at 03:52:13PM -0700, Joe Perches wrote: > > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > > > used for outputting sysfs

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Joe Perches
On Sat, 2020-08-29 at 08:22 +0200, Greg Kroah-Hartman wrote: > On Fri, Aug 28, 2020 at 03:52:13PM -0700, Joe Perches wrote: > > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > > used for outputting sysfs content requests and it's possible to > > overrun the buffer length. > >

Re: [PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-29 Thread Greg Kroah-Hartman
On Fri, Aug 28, 2020 at 03:52:13PM -0700, Joe Perches wrote: > sprintf does not know the PAGE_SIZE maximum of the temporary buffer > used for outputting sysfs content requests and it's possible to > overrun the buffer length. > > Add a generic sysfs_emit mechanism that knows that the size of the

[PATCH] sysfs: Add sysfs_emit to replace sprintf to PAGE_SIZE buffers.

2020-08-28 Thread Joe Perches
sprintf does not know the PAGE_SIZE maximum of the temporary buffer used for outputting sysfs content requests and it's possible to overrun the buffer length. Add a generic sysfs_emit mechanism that knows that the size of the temporary buffer and ensures that no overrun is done. Signed-off-by: