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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20241106073937.2219081-1-zhangheng@kylinos.cn>
Date: Wed,  6 Nov 2024 15:39:37 +0800
From: zhangheng <zhangheng@...inos.cn>
To: jk@...abs.org,
	joel@....id.au,
	alistair@...ple.id.au,
	eajames@...ux.ibm.com
Cc: linux-fsi@...ts.ozlabs.org,
	linux-kernel@...r.kernel.org,
	zhangheng <zhangheng@...inos.cn>
Subject: [PATCH] fsi: core: use sysfs_emit() instead of sprintf()

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: zhangheng <zhangheng@...inos.cn>
---
 drivers/fsi/fsi-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index e2e1e9df6115..2fdc866345ab 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -784,7 +784,7 @@ static ssize_t slave_send_echo_show(struct device *dev,
 {
 	struct fsi_slave *slave = to_fsi_slave(dev);
 
-	return sprintf(buf, "%u\n", slave->t_send_delay);
+	return sysfs_emit(buf, "%u\n", slave->t_send_delay);
 }
 
 static ssize_t slave_send_echo_store(struct device *dev,
@@ -828,7 +828,7 @@ static ssize_t chip_id_show(struct device *dev,
 {
 	struct fsi_slave *slave = to_fsi_slave(dev);
 
-	return sprintf(buf, "%d\n", slave->chip_id);
+	return sysfs_emit(buf, "%d\n", slave->chip_id);
 }
 
 static DEVICE_ATTR_RO(chip_id);
@@ -839,7 +839,7 @@ static ssize_t cfam_id_show(struct device *dev,
 {
 	struct fsi_slave *slave = to_fsi_slave(dev);
 
-	return sprintf(buf, "0x%x\n", slave->cfam_id);
+	return sysfs_emit(buf, "0x%x\n", slave->cfam_id);
 }
 
 static DEVICE_ATTR_RO(cfam_id);
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ