Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef21e175 authored by Jaejoong Kim's avatar Jaejoong Kim Committed by Takashi Iwai
Browse files

ALSA: Use scnprintf() instead of snprintf() for show



The show() method should use scnprintf() not snprintf() because snprintf()
may returns a value that exceeds its second argument.

Signed-off-by: default avatarJaejoong Kim <climbbb.kim@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 248a380a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -670,7 +670,7 @@ card_id_show_attr(struct device *dev,
		  struct device_attribute *attr, char *buf)
{
	struct snd_card *card = container_of(dev, struct snd_card, card_dev);
	return snprintf(buf, PAGE_SIZE, "%s\n", card->id);
	return scnprintf(buf, PAGE_SIZE, "%s\n", card->id);
}

static ssize_t
@@ -710,7 +710,7 @@ card_number_show_attr(struct device *dev,
		     struct device_attribute *attr, char *buf)
{
	struct snd_card *card = container_of(dev, struct snd_card, card_dev);
	return snprintf(buf, PAGE_SIZE, "%i\n", card->number);
	return scnprintf(buf, PAGE_SIZE, "%i\n", card->number);
}

static DEVICE_ATTR(number, S_IRUGO, card_number_show_attr, NULL);