diff mbox series

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

Message ID YyZb1K9b1gapCfep@playground
State New
Headers show
Series None | expand

Commit Message

Jules Irenge Sept. 17, 2022, 11:44 p.m. UTC
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@gmail.com>
---
 drivers/video/fbdev/uvesafb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Helge Deller Sept. 25, 2022, 11:08 a.m. UTC | #1
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@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,
diff mbox series

Patch

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,