From: Colin Ian King Date: Tue, 18 Dec 2018 11:35:52 +0000 (+0000) Subject: staging: most: sound: replace snprintf with strscpy X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a86028f8e3eea59517cb47895faad04b6ae8d8e1;p=openwrt%2Fstaging%2Fblogic.git staging: most: sound: replace snprintf with strscpy 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/most/sound/sound.c b/drivers/staging/most/sound/sound.c index 29a4c72e6357..79ab3a78c5ec 100644 --- a/drivers/staging/most/sound/sound.c +++ b/drivers/staging/most/sound/sound.c @@ -670,7 +670,7 @@ skip_adpt_alloc: 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) {