From: ye xingchen Date: Mon, 5 Dec 2022 11:18:56 +0000 (+0800) Subject: net: ethernet: use sysfs_emit() to instead of scnprintf() X-Git-Tag: v6.6.17~5932^2~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16dc16d9f058dce7031ee8b850f10622b8b5fb14;p=platform%2Fkernel%2Flinux-rpi.git net: ethernet: use sysfs_emit() to instead of scnprintf() Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen Reviewed-by: Leon Romanovsky Link: https://lore.kernel.org/r/202212051918564721658@zte.com.cn Signed-off-by: Jakub Kicinski --- diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index e02daa7..2edc8b7 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -398,7 +398,7 @@ EXPORT_SYMBOL(alloc_etherdev_mqs); ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len) { - return scnprintf(buf, PAGE_SIZE, "%*phC\n", len, addr); + return sysfs_emit(buf, "%*phC\n", len, addr); } EXPORT_SYMBOL(sysfs_format_mac);