mmc: core: Replacing sprintf() with snprintf()

While using the sysfs entry for getting the different bit values
of EXT_CSD register, it is returned by sprintf(). But sprintf() has
been deprecated, that's why replace with safe function snprintf().
By using this patch, PAGE_SIZE(4Kb) is the max number of characters
store in a buffer.

Change-Id: Ifb3dc39e8d3728094fff10c7e761dc19fdfaa854
Signed-off-by: Siba Prasad <sibap@codeaurora.org>
This commit is contained in:
Siba Prasad 2017-05-10 18:37:49 +05:30
parent 3d82d66409
commit e14f225493

View file

@ -15,7 +15,7 @@
static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \
{ \ { \
struct mmc_card *card = mmc_dev_to_card(dev); \ struct mmc_card *card = mmc_dev_to_card(dev); \
return sprintf(buf, fmt, args); \ return snprintf(buf, PAGE_SIZE, fmt, args); \
} \ } \
static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL) static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)