From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org, dsterba@suse.com
Subject: Re: [PATCH 1/2] btrfs: sysfs convert scnprintf and snprintf to use sysfs_emit
Date: Thu, 21 Oct 2021 18:00:08 +0200 [thread overview]
Message-ID: <20211021160008.GC20319@twin.jikos.cz> (raw)
In-Reply-To: <f748bd08259e2b770a5d9f2355c58c33d8566d16.1634598572.git.anand.jain@oracle.com>
On Tue, Oct 19, 2021 at 08:22:09AM +0800, Anand Jain wrote:
> @@ -1264,8 +1262,7 @@ char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags)
> continue;
>
> name = btrfs_feature_attrs[set][i].kobj_attr.attr.name;
> - len += scnprintf(str + len, bufsize - len, "%s%s",
> - len ? "," : "", name);
> + len += sysfs_emit_at(str, len, "%s%s", len ? "," : "", name);
This is a different pattern the 'bufsize' is 4096 which matches
PAGE_SIZE but it's not the same thing as the show/set callbacks.
> }
>
> return str;
> @@ -1304,8 +1301,8 @@ static void init_feature_attrs(void)
> if (fa->kobj_attr.attr.name)
> continue;
>
> - snprintf(name, BTRFS_FEATURE_NAME_MAX, "%s:%u",
> - btrfs_feature_set_names[set], i);
> + sysfs_emit(name, "%s:%u", btrfs_feature_set_names[set],
> + i);
And this one too, what's worse is that BTRFS_FEATURE_NAME_MAX is 13 but
sysfs_emit assumes PAGE_SIZE.
The rest is OK, so I'd drop the two changes.
next prev parent reply other threads:[~2021-10-21 16:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 0:22 [PATCH 0/2] provide fsid in sysfs devinfo Anand Jain
2021-10-19 0:22 ` [PATCH 1/2] btrfs: sysfs convert scnprintf and snprintf to use sysfs_emit Anand Jain
2021-10-21 13:35 ` [btrfs] 0f80799866: WARNING:at_fs/sysfs/file.c:#sysfs_emit kernel test robot
2021-10-21 13:35 ` kernel test robot
2021-10-21 15:30 ` Anand Jain
2021-10-21 15:30 ` Anand Jain
2021-10-21 16:06 ` David Sterba
2021-10-21 16:06 ` David Sterba
2021-10-21 16:18 ` Anand Jain
2021-10-21 16:18 ` Anand Jain
2021-10-21 16:00 ` David Sterba [this message]
2021-10-21 16:15 ` [PATCH 1/2] btrfs: sysfs convert scnprintf and snprintf to use sysfs_emit Anand Jain
2021-10-19 0:22 ` [PATCH 2/2] btrfs: sysfs add devinfo/fsid to retrieve fsid from the device Anand Jain
2021-10-20 18:59 ` David Sterba
2021-10-21 4:03 ` Anand Jain
2021-10-21 8:55 ` Anand Jain
2021-10-19 13:57 ` [PATCH 0/2] provide fsid in sysfs devinfo Josef Bacik
2021-10-20 2:26 ` Anand Jain
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=20211021160008.GC20319@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=anand.jain@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.