lkml.org 
[lkml]   [2021]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [char-misc-next 1/6] mei: use sprintf in tx_queue_limit_show sysfs
On Sat, Feb 06, 2021 at 04:43:20PM +0200, Tomas Winkler wrote:
> Using of snprintf is discouraged in sysfs.
> For simple u8 it is safe to use sprintf.
>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
> drivers/misc/mei/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
> index 9f6682033ed7..24a05f45b639 100644
> --- a/drivers/misc/mei/main.c
> +++ b/drivers/misc/mei/main.c
> @@ -1026,7 +1026,7 @@ static ssize_t tx_queue_limit_show(struct device *device,
> size = dev->tx_queue_limit;
> mutex_unlock(&dev->device_lock);
>
> - return snprintf(buf, PAGE_SIZE, "%u\n", size);
> + return sprintf(buf, "%u\n", size);

If you are going to do this, why not just convert it to use sysfs_emit()
instead?

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-02-06 15:49    [W:0.065 / U:1.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site