[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250728113150.39494-1-immu.ahmed1905@gmail.com>
Date: Mon, 28 Jul 2025 17:01:50 +0530
From: Mande Imran Ahmed <immu.ahmed1905@...il.com>
To: pkshih@...ltek.com,
kevin_yang@...ltek.com,
rtl8821cerfe2@...il.com,
phhuang@...ltek.com,
damon.chen@...ltek.com
Cc: linux-kernel@...r.kernel.org,
Mande Imran Ahmed <immu.ahmed1905@...il.com>
Subject: [PATCH] net:realtek:use sysfs_emit() instead of scnprintf() for sysfs consistency
The implementation of sysfs_emit() internally uses vscnprintf(buf, PAGE_SIZE, fmt, args), which assumes the buffer size is always PAGE_SIZE. This assumption is valid in sysfs, where the buffer passed to the read function is guaranteed to be PAGE_SIZE.
Using sysfs_emit_at() is a safer alternative when we need to control the offset, but both functions still rely on that fixed buffer size assumption. They are designed specifically for the sysfs environment, where such constraints are well-defined.
sysfs_emit_at() is optimized to work directly with sysfs interface for better performance and can avoid unnecessary overhead related to formatting the output.
With sysfs_emit_at() we can avoid overflow error's by using the fixed size of PAGE_SIZE.
Powered by blists - more mailing lists