Fwd: [PATCH] kernel: convert sysfs snprintf to sysfs_emit
From: hanyu001
Date: Thu Jul 13 2023 - 05:21:07 EST
Fix the following coccicheck warnings:
drivers/tty/vt/vt.c:3942:8-16:
WARNING: use scnprintf or sprintf
drivers/tty/vt/vt.c:3950:8-16:
WARNING: use scnprintf or sprintf
./kernel/cpu.c:2920:8-16: WARNING: use scnprintf or sprintf
./kernel/cpu.c:2907:8-16: WARNING: use scnprintf or sprintf
Signed-off-by: ztt <1549089851@xxxxxx>
---
kernel/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cpu.c b/kernel/cpu.c
index ed65aeaa94b5..1a9634236b54 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -2904,7 +2904,7 @@ static ssize_t control_show(struct device *dev,
{
const char *state = smt_states[cpu_smt_control];
- return snprintf(buf, PAGE_SIZE - 2, "%s\n", state);
+ return scnprintf(buf, PAGE_SIZE - 2, "%s\n", state);
}
static ssize_t control_store(struct device *dev, struct
device_attribute *attr,
@@ -2917,7 +2917,7 @@ static DEVICE_ATTR_RW(control);
static ssize_t active_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- return snprintf(buf, PAGE_SIZE - 2, "%d\n", sched_smt_active());
+ return scnprintf(buf, PAGE_SIZE - 2, "%d\n", sched_smt_active());
}
static DEVICE_ATTR_RO(active);