Skip to contentSkip to conversation

video: fbdev: replace spurious snprintf() with sprintf()

PATCH Applied Alex Dewar 2 participants 2 messages Aug 24, 2020 – Sep 8, 2020 Framebuffer layer

lore
Share & tools
lore

Alex Dewar

author
#0 lore raw

PATCH 1/1 video: fbdev: replace spurious snprintf() with sprintf()

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

---
 drivers/video/fbdev/sstfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sstfb.c +1 -1
index afe6d1b7c3a0..c05cdabeb11c 100644
@@ -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[] = {
Signature · 1 line
2.28.0
#1 lore raw
Quoted 4 lines · Alex Dewar

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

Applied to drm-misc-next tree, thanks.

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

Quoted 18 lines
---
 drivers/video/fbdev/sstfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sstfb.c +1 -1
index afe6d1b7c3a0..c05cdabeb11c 100644
@@ -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[] = {