* [PATCH] x86/events: Replace snprintf() with sysfs_emit()
@ 2022-05-06 3:44 Jiapeng Chong
0 siblings, 0 replies; only message in thread
From: Jiapeng Chong @ 2022-05-06 3:44 UTC (permalink / raw)
To: peterz
Cc: mingo, acme, mark.rutland, alexander.shishkin, jolsa, namhyung,
tglx, bp, dave.hansen, x86, hpa, linux-perf-users, linux-kernel,
Jiapeng Chong, Abaci Robot
coccicheck complains about the use of snprintf() in sysfs show
functions.
Fix the coccicheck warning:
./arch/x86/events/amd/core.c:1300:8-16: WARNING: use scnprintf or
sprintf.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
arch/x86/events/amd/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c
index 262e39a85031..47ef8aee15d2 100644
--- a/arch/x86/events/amd/core.c
+++ b/arch/x86/events/amd/core.c
@@ -1297,7 +1297,7 @@ static ssize_t branches_show(struct device *cdev,
struct device_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu.lbr_nr);
+ return sysfs_emit(buf, "%d\n", x86_pmu.lbr_nr);
}
static DEVICE_ATTR_RO(branches);
--
2.20.1.7.g153144c
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-06 3:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 3:44 [PATCH] x86/events: Replace snprintf() with sysfs_emit() Jiapeng Chong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).