ASoC: wcd_cpe_core: Fix buffer overflow in wcd_cpe_init
Clang warns:
../techpack/audio/asoc/codecs/wcd_cpe_core.c:1981:2: warning: 'snprintf'
size argument is too large; destination buffer has size 11, but size
argument is 13 [-Werror,-Wfortify-source]
snprintf(proc_name, (sizeof("cpe") + sizeof("_state") +
^
1 warning generated.
Fixes: 8e2277f79f0f ("audio-lnx: Initial change for techpack of audio
drivers.")
Change-Id: Ide9f1ba2b854ca854918f8ebfd22f8d24c12164b
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
diff --git a/techpack/audio/asoc/codecs/wcd_cpe_core.c b/techpack/audio/asoc/codecs/wcd_cpe_core.c
index 2e154e7..76fa299 100644
--- a/techpack/audio/asoc/codecs/wcd_cpe_core.c
+++ b/techpack/audio/asoc/codecs/wcd_cpe_core.c
@@ -1978,8 +1978,8 @@ struct wcd_cpe_core *wcd_cpe_init(const char *img_fname,
}
card = codec->component.card->snd_card;
- snprintf(proc_name, (sizeof("cpe") + sizeof("_state") +
- sizeof(id) - 2), "%s%d%s", cpe_name, id, state_name);
+ snprintf(proc_name, sizeof(proc_name), "%s%d%s", cpe_name, id,
+ state_name);
entry = snd_info_create_card_entry(card, proc_name,
card->proc_root);
if (entry) {