# \[PATCH\] edac: Use sysfs\_emit\_at() in dimmdev\_location\_show()

- Subsystems: EDAC-CORE, THE REST
- Maintainers: Borislav Petkov, Tony Luck, Linus Torvalds
- Status: LANDED (07897bdf7a9c · 2026-06-30 19:39)
- Landed in mainline as 07897bdf7a9c on 2026-06-30.
- List: linux-edac
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linux-edac/2025/06/3099708/t

## \[PATCH\] edac: Use sysfs\_emit\_at() in dimmdev\_location\_show()

- From: Abhinav Ananthu \<hidden\>
- Date: 2025-06-19 20:23:24 
- Message: https://ratatoskr.run/linux-edac/2025/06/3099708.md

```text
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 <redacted>
---
 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

```

## RE: \[PATCH\] edac: Use sysfs\_emit\_at() in dimmdev\_location\_show()

- From: Zhuo, Qiuxu \<hidden\>
- Date: 2025-06-23 01:57:19 
- Message: https://ratatoskr.run/linux-edac/2025/06/3102350.md

```text
> From: Abhinav Ananthu <redacted>
> 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 [ref]
> 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 <redacted>

LGTM. Thanks.

   Reviewed-by: Qiuxu Zhuo [ref]
```

## Re: \[PATCH\] edac: Use sysfs\_emit\_at() in dimmdev\_location\_show()

- From: Borislav Petkov \<bp@alien8.de\>
- Date: 2026-06-30 20:14:55 
- Message: https://ratatoskr.run/linux-edac/2026/06/17195392.md

```text
On Fri, Jun 20, 2025 at 01:51:34AM +0530, Abhinav Ananthu wrote:
> 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

> 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 <redacted>
> ---
>  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;
>  }
> --

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

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