From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: 王擎 <wangqing@vivo.com>
Cc: "efremov@linux.com" <efremov@linux.com>,
Jiri Slaby <jirislaby@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: 回复: [PATCH] tty: vt: replace snprintf in show functions with sysfs_emit
Date: Fri, 15 Oct 2021 09:29:38 +0200 [thread overview]
Message-ID: <YWkt4qt0pcORpkge@kroah.com> (raw)
In-Reply-To: <SL2PR06MB3082E66577E193F9EE9A09F8BDB99@SL2PR06MB3082.apcprd06.prod.outlook.com>
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
prev parent reply other threads:[~2021-10-15 7:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-15 6:51 [PATCH] tty: vt: replace snprintf in show functions with sysfs_emit Qing Wang
2021-10-15 6:59 ` Greg Kroah-Hartman
[not found] ` <APcArgDIEqvUlprBO4*Tk4rA.9.1634281148594.Hmail.wangqing@vivo.com>
2021-10-15 7:10 ` 回复: " 王擎
2021-10-15 7:29 ` Greg Kroah-Hartman [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=YWkt4qt0pcORpkge@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=efremov@linux.com \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangqing@vivo.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;
as well as URLs for NNTP newsgroup(s).