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: <20230504085522.2635-1-liubo03@inspur.com>
Date:   Thu, 4 May 2023 04:55:22 -0400
From:   Bo Liu <liubo03@...pur.com>
To:     <tony@...mide.com>
CC:     <linux-omap@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Bo Liu <liubo03@...pur.com>
Subject: [PATCH] bus: ti-sysc: convert sysfs sprintf to sysfs_emit

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: Bo Liu <liubo03@...pur.com>
---
 drivers/bus/ti-sysc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 6c49de37d5e9..e3d043de894d 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -969,9 +969,9 @@ static int sysc_show_rev(char *bufp, struct sysc *ddata)
 	int len;
 
 	if (ddata->offsets[SYSC_REVISION] < 0)
-		return sprintf(bufp, ":NA");
+		return sysfs_emit(bufp, ":NA");
 
-	len = sprintf(bufp, ":%08x", ddata->revision);
+	len = sysfs_emit(bufp, ":%08x", ddata->revision);
 
 	return len;
 }
@@ -980,9 +980,9 @@ static int sysc_show_reg(struct sysc *ddata,
 			 char *bufp, enum sysc_registers reg)
 {
 	if (ddata->offsets[reg] < 0)
-		return sprintf(bufp, ":NA");
+		return sysfs_emit(bufp, ":NA");
 
-	return sprintf(bufp, ":%x", ddata->offsets[reg]);
+	return sysfs_emit(bufp, ":%x", ddata->offsets[reg]);
 }
 
 static int sysc_show_name(char *bufp, struct sysc *ddata)
@@ -990,7 +990,7 @@ static int sysc_show_name(char *bufp, struct sysc *ddata)
 	if (!ddata->name)
 		return 0;
 
-	return sprintf(bufp, ":%s", ddata->name);
+	return sysfs_emit(bufp, ":%s", ddata->name);
 }
 
 /**
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ