[PATCH 2/2] video: fbdev: uvesafb: convert snprintf to scnprintf

Helge Deller deller at gmx.de
Sun Sep 25 11:08:41 UTC 2022


On 9/18/22 01:44, Jules Irenge wrote:
> Coccinelle reports a warning
>
> WARNING: use scnprintf or sprintf
>
> Adding to that,
> there has also been some slow migration from snprintf to scnprintf
> This article explains the rationale for this change
>
> https: //lwn.net/Articles/69419/
> Signed-off-by: Jules Irenge <jbi.octave at gmail.com>

applied.

Thanks,
Helge

> ---
>   drivers/video/fbdev/uvesafb.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
> index 4df6772802d7..fd5d701106e1 100644
> --- a/drivers/video/fbdev/uvesafb.c
> +++ b/drivers/video/fbdev/uvesafb.c
> @@ -1580,7 +1580,7 @@ static ssize_t uvesafb_show_vendor(struct device *dev,
>   	struct uvesafb_par *par = info->par;
>
>   	if (par->vbe_ib.oem_vendor_name_ptr)
> -		return snprintf(buf, PAGE_SIZE, "%s\n", (char *)
> +		return scnprintf(buf, PAGE_SIZE, "%s\n", (char *)
>   			(&par->vbe_ib) + par->vbe_ib.oem_vendor_name_ptr);
>   	else
>   		return 0;
> @@ -1595,7 +1595,7 @@ static ssize_t uvesafb_show_product_name(struct device *dev,
>   	struct uvesafb_par *par = info->par;
>
>   	if (par->vbe_ib.oem_product_name_ptr)
> -		return snprintf(buf, PAGE_SIZE, "%s\n", (char *)
> +		return scnprintf(buf, PAGE_SIZE, "%s\n", (char *)
>   			(&par->vbe_ib) + par->vbe_ib.oem_product_name_ptr);
>   	else
>   		return 0;
> @@ -1610,7 +1610,7 @@ static ssize_t uvesafb_show_product_rev(struct device *dev,
>   	struct uvesafb_par *par = info->par;
>
>   	if (par->vbe_ib.oem_product_rev_ptr)
> -		return snprintf(buf, PAGE_SIZE, "%s\n", (char *)
> +		return scnprintf(buf, PAGE_SIZE, "%s\n", (char *)
>   			(&par->vbe_ib) + par->vbe_ib.oem_product_rev_ptr);
>   	else
>   		return 0;
> @@ -1625,7 +1625,7 @@ static ssize_t uvesafb_show_oem_string(struct device *dev,
>   	struct uvesafb_par *par = info->par;
>
>   	if (par->vbe_ib.oem_string_ptr)
> -		return snprintf(buf, PAGE_SIZE, "%s\n",
> +		return scnprintf(buf, PAGE_SIZE, "%s\n",
>   			(char *)(&par->vbe_ib) + par->vbe_ib.oem_string_ptr);
>   	else
>   		return 0;
> @@ -1639,7 +1639,7 @@ static ssize_t uvesafb_show_nocrtc(struct device *dev,
>   	struct fb_info *info = dev_get_drvdata(dev);
>   	struct uvesafb_par *par = info->par;
>
> -	return snprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc);
> +	return scnprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc);
>   }
>
>   static ssize_t uvesafb_store_nocrtc(struct device *dev,



More information about the dri-devel mailing list