# \[PATCH\] video: fbdev: replace spurious snprintf() with sprintf()

- Subsystems: FRAMEBUFFER LAYER, THE REST
- Maintainers: Helge Deller, Linus Torvalds
- Status: LANDED (3f614236406f · 2020-09-08 11:33)
- Landed in mainline as 3f614236406f on 2020-09-08.
- List: linux-fbdev
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-fbdev/2020/08/6081116/t

## \[PATCH\] video: fbdev: replace spurious snprintf() with sprintf()

- From: Alex Dewar \<hidden\>
- Date: 2020-08-24 17:44:22 
- Message: https://ratatoskr.run/linux-fbdev/2020/08/6081116.md

```text
par->vgapass is a u8, so if we are assuming that buf is at least
PAGE_SIZE then the extra checking is pointless.

Signed-off-by: Alex Dewar <redacted>
---
 drivers/video/fbdev/sstfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c
index afe6d1b7c3a0..c05cdabeb11c 100644
--- a/drivers/video/fbdev/sstfb.c
+++ b/drivers/video/fbdev/sstfb.c
@@ -733,7 +733,7 @@ static ssize_t show_vgapass(struct device *device, struct device_attribute *attr
 {
 	struct fb_info *info = dev_get_drvdata(device);
 	struct sstfb_par *par = info->par;
-	return snprintf(buf, PAGE_SIZE, "%d\n", par->vgapass);
+	return sprintf(buf, "%d\n", par->vgapass);
 }
 
 static struct device_attribute device_attrs[] = {
-- 
2.28.0
```

## Re: \[PATCH\] video: fbdev: replace spurious snprintf() with sprintf()

- From: Bartlomiej Zolnierkiewicz \<hidden\>
- Date: 2020-09-08 12:49:55 
- Message: https://ratatoskr.run/linux-fbdev/2020/09/6097409.md

```text

On 8/24/20 7:44 PM, Alex Dewar wrote:
> par->vgapass is a u8, so if we are assuming that buf is at least
> PAGE_SIZE then the extra checking is pointless.
> 
> Signed-off-by: Alex Dewar <redacted>

Applied to drm-misc-next tree, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> ---
>  drivers/video/fbdev/sstfb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c
> index afe6d1b7c3a0..c05cdabeb11c 100644
> --- a/drivers/video/fbdev/sstfb.c
> +++ b/drivers/video/fbdev/sstfb.c
> @@ -733,7 +733,7 @@ static ssize_t show_vgapass(struct device *device, struct device_attribute *attr
>  {
>  	struct fb_info *info = dev_get_drvdata(device);
>  	struct sstfb_par *par = info->par;
> -	return snprintf(buf, PAGE_SIZE, "%d\n", par->vgapass);
> +	return sprintf(buf, "%d\n", par->vgapass);
>  }
>  
>  static struct device_attribute device_attrs[] = {
> 
```
