lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250317150448777DwuLrfzwC0KXdv5RYpZFq@zte.com.cn>
Date: Mon, 17 Mar 2025 15:04:48 +0800 (CST)
From: <tang.dongxing@....com.cn>
To: <lee@...nel.org>
Cc: <pavel@...nel.org>, <zack.rusin@...adcom.com>, <namcao@...utronix.de>,
        <tang.dongxing@....com.cn>, <tglx@...utronix.de>,
        <mmkurbanov@...utedevices.com>, <linux-leds@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <ye.xingchen@....com.cn>,
        <yang.guang5@....com.cn>, <yang.yang29@....com.cn>,
        <xu.xin16@....com.cn>
Subject: [PATCH] leds: trigger: pattern: use sysfs_emit_at() instead of

 scnprintf()

From: TangDongxing <tang.dongxing@....com.cn>

Follow the advice in Documentation/filesystems/sysfs.rst:
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.

Signed-off-by: TangDongxing <tang.dongxing@....com.cn>
---
 drivers/leds/trigger/ledtrig-pattern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/trigger/ledtrig-pattern.c b/drivers/leds/trigger/ledtrig-pattern.c
index a594bd5e2233..861122c3e97b 100644
--- a/drivers/leds/trigger/ledtrig-pattern.c
+++ b/drivers/leds/trigger/ledtrig-pattern.c
@@ -256,7 +256,7 @@ static ssize_t pattern_trig_show_patterns(struct pattern_trig_data *data,
 		goto out;

 	for (i = 0; i < data->npatterns; i++) {
-		count += scnprintf(buf + count, PAGE_SIZE - count,
+		count += sysfs_emit_at(buf, count,
 				   "%d %u ",
 				   data->patterns[i].brightness,
 				   data->patterns[i].delta_t);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ