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: <20251103123403.62076-2-thorsten.blum@linux.dev>
Date: Mon,  3 Nov 2025 13:34:03 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Michael Hennerich <michael.hennerich@...log.com>,
	Arnd Bergmann <arnd@...db.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] misc: ad525x_dpot: Replace sprintf with sysfs_emit in sysfs_show_reg

Replace sprintf() with sysfs_emit() in sysfs_show_reg(). sysfs_emit() is
preferred for formatting sysfs output as it provides better bounds
checking.  No functional changes.

Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
Suggested-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 drivers/misc/ad525x_dpot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 04683b981e54..519f97089a00 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -419,7 +419,7 @@ static ssize_t sysfs_show_reg(struct device *dev,
 	s32 value;
 
 	if (reg & DPOT_ADDR_OTP_EN)
-		return sprintf(buf, "%s\n", str_enabled_disabled(
+		return sysfs_emit(buf, "%s\n", str_enabled_disabled(
 			test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)));
 
 	mutex_lock(&data->update_lock);
@@ -437,9 +437,9 @@ static ssize_t sysfs_show_reg(struct device *dev,
 	 */
 
 	if (reg & DPOT_REG_TOL)
-		return sprintf(buf, "0x%04x\n", value & 0xFFFF);
+		return sysfs_emit(buf, "0x%04x\n", value & 0xFFFF);
 	else
-		return sprintf(buf, "%u\n", value & data->rdac_mask);
+		return sysfs_emit(buf, "%u\n", value & data->rdac_mask);
 }
 
 static ssize_t sysfs_set_reg(struct device *dev,
-- 
2.51.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ