[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YWkt4qt0pcORpkge@kroah.com>
Date: Fri, 15 Oct 2021 09:29:38 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: 王擎 <wangqing@...o.com>
Cc: "efremov@...ux.com" <efremov@...ux.com>,
Jiri Slaby <jirislaby@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: 回复: [PATCH] tty: vt:
replace snprintf in show functions with sysfs_emit
On Fri, Oct 15, 2021 at 07:10:42AM +0000, 王擎 wrote:
>
> >> show() must not use snprintf() when formatting the value to be
> >> returned to user space.
> >
> >Again, who is making this "must" requirement?
> >
> >I, as the sysfs maintainer, am not saying that all existing show
> >functions MUST be converted, so I find it hard to believe that someone
> >else is...
> >
>
> According to Documentation/filesystems/sysfs.txt:
> show() methods of device attributes should return the number
> of bytes printed into the buffer. This is the return value of
> scnprintf(). snprintf() returns the length the resulting string.
>
> So, show() must not use snprintf() when formatting
> the value to be returned to user space.
Ok, then you need to document this _MUCH_ better, saying that the value
returned by the kernel today is WRONG, and that this is a bugfix.
And can you see the difference here? Have you tested these?
> Also, use sysfs_emit directly makes more sense.
I agree, but your changelog did not mention that at all.
thanks,
greg k-h
Powered by blists - more mailing lists