* [PATCH][next] staging: most: sound: replace snprintf with strscpy
@ 2018-12-18 11:35 Colin King
0 siblings, 0 replies; only message in thread
From: Colin King @ 2018-12-18 11:35 UTC (permalink / raw)
To: Greg Kroah-Hartman, Christian Gromm, devel; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Using snprintf without a format specifier is potentially risky if
the string device_name contains format specifiers. Replace this with
the safer and more efficient strscpy.
Cleans up clang warning:
drivers/staging/most/sound/sound.c:673:41: warning: format string is not
a string literal (potentially insecure) [-Wformat-security]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/most/sound/sound.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c
index 29a4c72e6357..ccabf5922a73 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -670,7 +670,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
goto err_free_adpt;
pcm->private_data = channel;
- snprintf(pcm->name, sizeof(pcm->name), device_name);
+ strscpy(pcm->name, device_name, sizeof(pcm->name));
snd_pcm_set_ops(pcm, direction, &pcm_ops);
if (create) {
--
2.19.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-18 11:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 11:35 [PATCH][next] staging: most: sound: replace snprintf with strscpy Colin King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).