diff options
| author | HariKrishna Sagala <hariconscious@gmail.com> | 2025-11-13 19:56:38 +0530 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-11-21 16:25:02 +0000 |
| commit | df919994d323c7c86e32fa2745730136d58ada12 (patch) | |
| tree | 61bf68884ab4bf7b59ad1ed0d714e28975a9b186 /sound/soc/intel/avs/debugfs.c | |
| parent | 3efee7362dbf896072af1c1aaeaf9fd6e235c591 (diff) | |
ASoC: Intel: avs: Replace snprintf() with scnprintf()
snprintf() as defined by the C99 standard,returns the
number of characters that *would have been* written if
enough space were available.Use scnprintf() that returns
the actual number of characters written.
Link: https://github.com/KSPP/linux/issues/105
Signed-off-by: HariKrishna Sagala <hariconscious@gmail.com>
Link: https://patch.msgid.link/20251113142637.259737-2-hariconscious@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/avs/debugfs.c')
| -rw-r--r-- | sound/soc/intel/avs/debugfs.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c index 3534de46f9e4..701c247227bf 100644 --- a/sound/soc/intel/avs/debugfs.c +++ b/sound/soc/intel/avs/debugfs.c @@ -119,16 +119,13 @@ static ssize_t probe_points_read(struct file *file, char __user *to, size_t coun } for (i = 0; i < num_desc; i++) { - ret = snprintf(buf + len, PAGE_SIZE - len, - "Id: %#010x Purpose: %d Node id: %#x\n", - desc[i].id.value, desc[i].purpose, desc[i].node_id.val); - if (ret < 0) - goto free_desc; + ret = scnprintf(buf + len, PAGE_SIZE - len, + "Id: %#010x Purpose: %d Node id: %#x\n", + desc[i].id.value, desc[i].purpose, desc[i].node_id.val); len += ret; } ret = simple_read_from_buffer(to, count, ppos, buf, len); -free_desc: kfree(desc); exit: kfree(buf); |