From: Ido Schimmel <idosch@nvidia.com>
To: David Corvaglia <david@corvaglia.dev>
Cc: razor@blackwall.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
bridge@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: bridge: use sysfs_emit instead of sprintf
Date: Sun, 1 Feb 2026 17:19:10 +0200 [thread overview]
Message-ID: <20260201151910.GA139675@shredder> (raw)
In-Reply-To: <0100019c14f90490-950ddd9b-1897-4111-bddd-0d4b8abf380a-000000@email.amazonses.com>
On Sat, Jan 31, 2026 at 04:53:09PM +0000, David Corvaglia wrote:
> Replace sprintf with sysfs_emit in sysfs show() methods as outlined in
> Documentation/filesystems/sysfs.rst. sysfs_emit is preferred to sprintf
> in sysfs show() methods as it is safer with buffer handling.
>
> Signed-off-by: David Corvaglia <david@corvaglia.dev>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
But the patch is introducing a few alignment issues and it would be good
to fix them in v2. See below.
[...]
> @@ -87,7 +87,7 @@ static DEVICE_ATTR_RW(forward_delay);
> static ssize_t hello_time_show(struct device *d, struct device_attribute *attr,
> char *buf)
> {
> - return sprintf(buf, "%lu\n",
> + return sysfs_emit(buf, "%lu\n",
> jiffies_to_clock_t(to_bridge(d)->hello_time));
Here
> }
>
> @@ -108,7 +108,7 @@ static DEVICE_ATTR_RW(hello_time);
> static ssize_t max_age_show(struct device *d, struct device_attribute *attr,
> char *buf)
> {
> - return sprintf(buf, "%lu\n",
> + return sysfs_emit(buf, "%lu\n",
> jiffies_to_clock_t(to_bridge(d)->max_age));
Here
> }
>
[...]
> static int set_group_fwd_mask(struct net_bridge *br, unsigned long val,
> @@ -200,7 +200,7 @@ static ssize_t priority_show(struct device *d, struct device_attribute *attr,
> char *buf)
> {
> struct net_bridge *br = to_bridge(d);
> - return sprintf(buf, "%d\n",
> + return sysfs_emit(buf, "%d\n",
> (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1]);
Here
> }
[...]
> @@ -425,7 +425,7 @@ static ssize_t multicast_query_use_ifaddr_show(struct device *d,
> char *buf)
> {
> struct net_bridge *br = to_bridge(d);
> - return sprintf(buf, "%d\n",
> + return sysfs_emit(buf, "%d\n",
> br_opt_get(br, BROPT_MULTICAST_QUERY_USE_IFADDR));
Here
> }
> @@ -583,7 +583,7 @@ static ssize_t multicast_last_member_interval_show(
> struct device *d, struct device_attribute *attr, char *buf)
> {
> struct net_bridge *br = to_bridge(d);
> - return sprintf(buf, "%lu\n",
> + return sysfs_emit(buf, "%lu\n",
> jiffies_to_clock_t(br->multicast_ctx.multicast_last_member_interval));
Here
> }
>
> @@ -606,7 +606,7 @@ static ssize_t multicast_membership_interval_show(
> struct device *d, struct device_attribute *attr, char *buf)
> {
> struct net_bridge *br = to_bridge(d);
> - return sprintf(buf, "%lu\n",
> + return sysfs_emit(buf, "%lu\n",
> jiffies_to_clock_t(br->multicast_ctx.multicast_membership_interval));
Here
> }
>
> @@ -630,7 +630,7 @@ static ssize_t multicast_querier_interval_show(struct device *d,
> char *buf)
> {
> struct net_bridge *br = to_bridge(d);
> - return sprintf(buf, "%lu\n",
> + return sysfs_emit(buf, "%lu\n",
> jiffies_to_clock_t(br->multicast_ctx.multicast_querier_interval));
Here
> }
>
> @@ -654,7 +654,7 @@ static ssize_t multicast_query_interval_show(struct device *d,
> char *buf)
> {
> struct net_bridge *br = to_bridge(d);
> - return sprintf(buf, "%lu\n",
> + return sysfs_emit(buf, "%lu\n",
> jiffies_to_clock_t(br->multicast_ctx.multicast_query_interval));
Here
> }
[...]
> @@ -727,7 +727,7 @@ static ssize_t multicast_stats_enabled_show(struct device *d,
> {
> struct net_bridge *br = to_bridge(d);
>
> - return sprintf(buf, "%d\n",
> + return sysfs_emit(buf, "%d\n",
> br_opt_get(br, BROPT_MULTICAST_STATS_ENABLED));
Here
> }
prev parent reply other threads:[~2026-02-01 15:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-31 16:53 [PATCH net-next] net: bridge: use sysfs_emit instead of sprintf David Corvaglia
2026-02-01 8:29 ` Nikolay Aleksandrov
2026-02-01 15:19 ` Ido Schimmel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260201151910.GA139675@shredder \
--to=idosch@nvidia.com \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=david@corvaglia.dev \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox