summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wsa881x.c
diff options
context:
space:
mode:
authorNathan Chancellor <natechancellor@gmail.com>2019-09-28 18:43:44 -0700
committerMichael Bestas <mkbestas@lineageos.org>2020-02-02 01:41:08 +0200
commit8099b2c2cec5fc8750c9bd63e178d389b8cb45cb (patch)
tree683eabd7a69c09059a2dee52f998f1025b528720 /sound/soc/codecs/wsa881x.c
parentf0fc0c35e084c99f1101b4332700493ad66b33c4 (diff)
ASoC: wsa881x: Fix buffer overflow in wsa881x_swrslave_reg_show
Clang warns: ../sound/soc/codecs/wsa881x.c:365:9: warning: 'snprintf' size argument is too large; destination buffer has size 20, but size argument is 25 [-Wfortify-source] len = snprintf(tmp_buf, 25, "0x%.3x: 0x%.2x\n", i, ^ 1 warning generated. Fixes: 03f5d7efe220 ("ASoC: wcd: Add Audio codec drivers for MSM targets") Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Diffstat (limited to 'sound/soc/codecs/wsa881x.c')
-rw-r--r--sound/soc/codecs/wsa881x.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
index 0c672fd89652..44ae263ba4d1 100644
--- a/sound/soc/codecs/wsa881x.c
+++ b/sound/soc/codecs/wsa881x.c
@@ -362,8 +362,8 @@ static ssize_t wsa881x_swrslave_reg_show(char __user *ubuf, size_t count,
continue;
swr_read(dbgwsa881x->swr_slave, devnum,
i, &reg_val, 1);
- len = snprintf(tmp_buf, 25, "0x%.3x: 0x%.2x\n", i,
- (reg_val & 0xFF));
+ len = snprintf(tmp_buf, sizeof(tmp_buf), "0x%.3x: 0x%.2x\n",
+ i, (reg_val & 0xFF));
if ((total + len) >= count - 1)
break;
if (copy_to_user((ubuf + total), tmp_buf, len)) {