Skip to contentSkip to conversation

edac: Use sysfs_emit_at() in dimmdev_location_show()

PATCH Applied Abhinav Ananthu 3 participants 3 messages Jun 19, 2025 – Jun 30 EDAC-core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 edac: Use sysfs_emit_at() in dimmdev_location_show()

Replace the use of scnprintf() with sysfs_emit_at() in dimmdev_location_show() to format the output into the sysfs buffer.

This change improves clarity and ensures proper bounds checking in line with the preferred sysfs_emit() API usage for sysfs 'show' functions. The PAGE_SIZE check is now handled internally by the helper.

No functional change intended.

---
 drivers/edac/edac_mc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/edac_mc_sysfs.c +1 -1
index 0f338adf7d93..1b611650de3f 100644
@@ -500,7 +500,7 @@ static ssize_t dimmdev_location_show(struct device *dev,
 	ssize_t count;
 
 	count = edac_dimm_info_location(dimm, data, PAGE_SIZE);
-	count += scnprintf(data + count, PAGE_SIZE - count, "\n");
+	count += sysfs_emit_at(data, count, "\n");
 
 	return count;
 }
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

From: Abhinav Ananthu <[email protected]>
Sent: Friday, June 20, 2025 4:22 AM
To: [email protected]
Cc: Luck, Tony <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Abhinav Ananthu <[email protected]>
Subject: [PATCH] edac: Use sysfs_emit_at() in dimmdev_location_show()

Replace the use of scnprintf() with sysfs_emit_at() in dimmdev_location_show() to format the output into the sysfs buffer.

Quoted 7 lines

This change improves clarity and ensures proper bounds checking in line with the preferred sysfs_emit() API usage for sysfs 'show'
functions. The PAGE_SIZE check is now handled internally by the helper.

No functional change intended.

LGTM. Thanks.

maintainer Applied
#2 lore raw
In reply to Abhinav Ananthu
Quoted 4 lines · Abhinav Ananthu

Replace the use of scnprintf() with sysfs_emit_at() in dimmdev_location_show() to format the output into the sysfs buffer.

This change improves clarity and ensures proper bounds checking in

Avoid having "This patch" or "This commit" in the commit message. It is tautologically useless.

Also, do

$ git grep 'This patch' Documentation/process

for more details.

I'll fix it up for now so this is a hint for the future.

Also, do not top-post or use HTML mails when replying ot the mailing list.

Some info about the kernel development process to peruse:

https://docs.kernel.org/process/development-process.html

Quoted 15 lines

line with the preferred sysfs_emit() API usage for sysfs 'show' functions. The PAGE_SIZE check is now handled internally by the helper.

No functional change intended.

---
 drivers/edac/edac_mc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/edac_mc_sysfs.c +0 -0
index 0f338adf7d93..1b611650de3f 100644

drivers/edac/edac_mc_sysfs.c static ssize_t dimmdev_location_show(struct device *dev,

Quoted 9 lines
drivers/edac/edac_mc_sysfs.c +1 -2
@@ -500,7 +500,7 @@ static ssize_t dimmdev_location_show(struct device *dev,
 	ssize_t count;
 
 	count = edac_dimm_info_location(dimm, data, PAGE_SIZE);
-	count += scnprintf(data + count, PAGE_SIZE - count, "\n");
+	count += sysfs_emit_at(data, count, "\n");
 
 	return count;
 }
--

Applied, thanks.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette