On Tue, Oct 19, 2021 at 08:22:09AM +0800, Anand Jain wrote:
quoted hunk ↗ jump to hunk
@@ -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.
quoted hunk ↗ jump to hunk
}
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.