linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] edac: Use sysfs_emit_at() in dimmdev_location_show()
@ 2025-06-19 20:21 Abhinav Ananthu
  2025-06-23  1:57 ` Zhuo, Qiuxu
  0 siblings, 1 reply; 2+ messages in thread
From: Abhinav Ananthu @ 2025-06-19 20:21 UTC (permalink / raw)
  To: bp
  Cc: tony.luck, james.morse, mchehab, rric, linux-edac, linux-kernel,
	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
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.

Signed-off-by: Abhinav Ananthu <abhinav.ogl@gmail.com>
---
 drivers/edac/edac_mc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 0f338adf7d93..1b611650de3f 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -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;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] edac: Use sysfs_emit_at() in dimmdev_location_show()
  2025-06-19 20:21 [PATCH] edac: Use sysfs_emit_at() in dimmdev_location_show() Abhinav Ananthu
@ 2025-06-23  1:57 ` Zhuo, Qiuxu
  0 siblings, 0 replies; 2+ messages in thread
From: Zhuo, Qiuxu @ 2025-06-23  1:57 UTC (permalink / raw)
  To: Abhinav Ananthu, bp@alien8.de
  Cc: Luck, Tony, james.morse@arm.com, mchehab@kernel.org,
	rric@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org

> From: Abhinav Ananthu <abhinav.ogl@gmail.com>
> Sent: Friday, June 20, 2025 4:22 AM
> To: bp@alien8.de
> Cc: Luck, Tony <tony.luck@intel.com>; james.morse@arm.com;
> mchehab@kernel.org; rric@kernel.org; linux-edac@vger.kernel.org; linux-
> kernel@vger.kernel.org; Abhinav Ananthu <abhinav.ogl@gmail.com>
> 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.
> 
> 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.
> 
> Signed-off-by: Abhinav Ananthu <abhinav.ogl@gmail.com>

LGTM. Thanks.

   Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-23  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-19 20:21 [PATCH] edac: Use sysfs_emit_at() in dimmdev_location_show() Abhinav Ananthu
2025-06-23  1:57 ` Zhuo, Qiuxu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).