aboutsummaryrefslogtreecommitdiff
path: root/sound/hda
diff options
context:
space:
mode:
authorTakashi Iwai2020-03-13 14:02:41 +0100
committerTakashi Iwai2020-03-13 15:59:04 +0100
commit0a7efa14e61ae2132fd718887deb28479b33386b (patch)
treebbc0c46cce80b04d5f35daeb1b19bd77d3aedff9 /sound/hda
parent296a37fd029dd8a911396e3c28e0bbd5a2720a5d (diff)
ALSA: hda: Use scnprintf() for string truncation
snd_hdac_codec_modalias() truncates the string to the given size and returns its size, but it returned a wrong size from snprintf(). snprintf() returns the would-be-output size, not the actual size. Use scnprintf() instead to return the correct size. Link: https://lore.kernel.org/r/20200313130241.8970-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda')
-rw-r--r--sound/hda/hdac_device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 9a526aeef8da..e3119f5cb0d5 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -204,7 +204,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_set_chip_name);
*/
int snd_hdac_codec_modalias(struct hdac_device *codec, char *buf, size_t size)
{
- return snprintf(buf, size, "hdaudio:v%08Xr%08Xa%02X\n",
+ return scnprintf(buf, size, "hdaudio:v%08Xr%08Xa%02X\n",
codec->vendor_id, codec->revision_id, codec->type);
}
EXPORT_SYMBOL_GPL(snd_hdac_codec_modalias);