Skip to contentSkip to conversation

drm/sti: use seq_puts to display a string

PATCH In review Nicolas Iooss 2 participants 2 messages Mar 31, 2017 – May 9, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/sti: use seq_puts to display a string

gdp_dbg_ctl() uses seq_printf() to display a color format name even though there is no format string. When using -Wformat-string, gcc reports the following warning:

drivers/gpu/drm/sti/sti_gdp.c: In function 'gdp_dbg_ctl':
drivers/gpu/drm/sti/sti_gdp.c:150:18: warning: format not a string literal and no format arguments [-Wformat-security]
seq_printf(s, gdp_format_to_str[i].name);
^~~~~~~~~~~~~~~~~

Silence this warning by using seq_puts() instead.

---
 drivers/gpu/drm/sti/sti_gdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_gdp.c +1 -1
index 86279f5022c2..1bbfcf01d401 100644
@@ -147,7 +147,7 @@ static void gdp_dbg_ctl(struct seq_file *s, int val)
 	seq_puts(s, "\tColor:");
 	for (i = 0; i < ARRAY_SIZE(gdp_format_to_str); i++) {
 		if (gdp_format_to_str[i].format == (val & 0x1F)) {
-			seq_printf(s, gdp_format_to_str[i].name);
+			seq_puts(s, gdp_format_to_str[i].name);
 			break;
 		}
 	}
Signature · 1 line
2.11.1
Acked-by on v1 1/1
#1 lore raw

2017-03-31 21:25 GMT+02:00 Nicolas Iooss <[email protected]>:

Quoted 31 lines

gdp_dbg_ctl() uses seq_printf() to display a color format name even though there is no format string. When using -Wformat-string, gcc reports the following warning:

drivers/gpu/drm/sti/sti_gdp.c: In function 'gdp_dbg_ctl':
drivers/gpu/drm/sti/sti_gdp.c:150:18: warning: format not a string literal and no format arguments [-Wformat-security]
seq_printf(s, gdp_format_to_str[i].name);
^~~~~~~~~~~~~~~~~

Silence this warning by using seq_puts() instead.

---
 drivers/gpu/drm/sti/sti_gdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_gdp.c +1 -2
index 86279f5022c2..1bbfcf01d401 100644
@@ -147,7 +147,7 @@ static void gdp_dbg_ctl(struct seq_file *s, int val)
        seq_puts(s, "\tColor:");
        for (i = 0; i < ARRAY_SIZE(gdp_format_to_str); i++) {
                if (gdp_format_to_str[i].format == (val & 0x1F)) {
-                       seq_printf(s, gdp_format_to_str[i].name);
+                       seq_puts(s, gdp_format_to_str[i].name);
                        break;
                }
        }
--
Quoted 2 lines

2.11.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel