diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-03-13 16:02:23 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-03-13 17:58:35 +0300 |
commit | 296a37fd029dd8a911396e3c28e0bbd5a2720a5d (patch) | |
tree | e69037c3f197b0e5a27203dc7c5af566820ca0fc /sound/core/pcm.c | |
parent | 3db1b00f2122bfe259bdb19f7c0bfcaec54568e3 (diff) | |
download | linux-296a37fd029dd8a911396e3c28e0bbd5a2720a5d.tar.xz |
ALSA: pcm: Fix superfluous snprintf() usage
show_pcm_class() returns obviously a short string that can't overflow
PAGE_SIZE. And even if it were to overflow, using snprintf() there is
just wrong, as it doesn't return the correct size.
So simplify with sprintf() instead.
Link: https://lore.kernel.org/r/20200313130223.8908-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm.c')
-rw-r--r-- | sound/core/pcm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index a141a301369f..b6d2331a82f7 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -1019,7 +1019,7 @@ static ssize_t show_pcm_class(struct device *dev, str = "none"; else str = strs[pcm->dev_class]; - return snprintf(buf, PAGE_SIZE, "%s\n", str); + return sprintf(buf, "%s\n", str); } static DEVICE_ATTR(pcm_class, 0444, show_pcm_class, NULL); |