summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGen Zhang <blackgod016574@gmail.com>2019-05-29 09:53:05 +0800
committerMark Brown <broonie@kernel.org>2019-05-29 16:35:35 +0100
commita54988113985ca22e414e132054f234fc8a92604 (patch)
tree2774606953d3f7b4dc2ad99ebfa936cbd61521dc
parent99a12c766e20f76eb47819fd56ff60b2010048c6 (diff)
wcd9335: fix a incorrect use of kstrndup()
In wcd9335_codec_enable_dec(), 'widget_name' is allocated by kstrndup(). However, according to doc: "Note: Use kmemdup_nul() instead if the size is known exactly." So we should use kmemdup_nul() here instead of kstrndup(). Signed-off-by: Gen Zhang <blackgod016574@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/wcd9335.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c
index a04a7cedd99d..85737fe54474 100644
--- a/sound/soc/codecs/wcd9335.c
+++ b/sound/soc/codecs/wcd9335.c
@@ -2734,7 +2734,7 @@ static int wcd9335_codec_enable_dec(struct snd_soc_dapm_widget *w,
char *dec;
u8 hpf_coff_freq;
- widget_name = kstrndup(w->name, 15, GFP_KERNEL);
+ widget_name = kmemdup_nul(w->name, 15, GFP_KERNEL);
if (!widget_name)
return -ENOMEM;