[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YGbhLxwZO9k/330J@kroah.com>
Date: Fri, 2 Apr 2021 11:17:35 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Carlis <zhangxuezhi3@...il.com>
Cc: zhangxuezhi1@...ong.com, devel@...verdev.osuosl.org,
linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] staging: fbtft: change snprintf() to scnprintf()
On Fri, Apr 02, 2021 at 09:05:01AM +0000, Carlis wrote:
> From: Xuezhi Zhang <zhangxuezhi1@...ong.com>
>
> show() must not use snprintf() when formatting the value to
> be returned to user space.
Why not? The code is just fine as-is.
>
> Signed-off-by: Xuezhi Zhang <zhangxuezhi1@...ong.com>
> ---
> drivers/staging/fbtft/fbtft-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/fbtft/fbtft-sysfs.c b/drivers/staging/fbtft/fbtft-sysfs.c
> index 26e52cc2de64..7df92db648d6 100644
> --- a/drivers/staging/fbtft/fbtft-sysfs.c
> +++ b/drivers/staging/fbtft/fbtft-sysfs.c
> @@ -199,7 +199,7 @@ static ssize_t show_debug(struct device *device,
> struct fb_info *fb_info = dev_get_drvdata(device);
> struct fbtft_par *par = fb_info->par;
>
> - return snprintf(buf, PAGE_SIZE, "%lu\n", par->debug);
> + return scnprintf(buf, PAGE_SIZE, "%lu\n", par->debug);
If you really want to "fix" this, please just use sysfs_emit(). This
change as-is, does nothing.
thanks,
greg k-h
Powered by blists - more mailing lists