[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <SL2PR06MB3082E66577E193F9EE9A09F8BDB99@SL2PR06MB3082.apcprd06.prod.outlook.com>
Date: Fri, 15 Oct 2021 07:10:42 +0000
From: 王擎 <wangqing@...o.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"efremov@...ux.com" <efremov@...ux.com>
CC: Jiri Slaby <jirislaby@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: 回复: [PATCH] tty: vt: replace snprintf in show functions with sysfs_emit
>> 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.
Also, use sysfs_emit directly makes more sense.
Thanks,
Qing
>
>>
>> Fix the following coccicheck warning:
>> drivers/tty/vt/vt.c:3902: WARNING: use scnprintf or sprintf.
>> drivers/tty/vt/vt.c:3910: WARNING: use scnprintf or sprintf.
>
>Someone needs to change this warning to show the correct thing here.
>
>thanks,
>
>greg k-h
Powered by blists - more mailing lists