From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org,
Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH v10 3/3] btrfs: create read policy sysfs attribute, pid
Date: Thu, 29 Oct 2020 20:30:18 +0100 [thread overview]
Message-ID: <20201029193018.GT6756@twin.jikos.cz> (raw)
In-Reply-To: <a74b6fdd-55dc-e890-78df-c19d0430b4a2@oracle.com>
On Fri, Oct 30, 2020 at 03:30:10AM +0800, Anand Jain wrote:
>
>
> On 30/10/20 12:45 am, David Sterba wrote:
> > On Wed, Oct 28, 2020 at 09:14:47PM +0800, Anand Jain wrote:
> >> +static ssize_t btrfs_read_policy_store(struct kobject *kobj,
> >> + struct kobj_attribute *a,
> >> + const char *buf, size_t len)
> >> +{
> >> + int i;
> >> + struct btrfs_fs_devices *fs_devices = to_fs_devs(kobj);
> >> +
> >> + for (i = 0; i < BTRFS_NR_READ_POLICY; i++) {
> >> + if (btrfs_strmatch(buf, btrfs_read_policy_name[i])) {
> >
> > Does sysfs guarantee that the buf is nul terminated string or that it
> > contains a null at all? Because if not, the skip_space step of strmatch
> > could run out of the buffer.
> >
>
> It does
>
> [ 173.555507] ? btrfs_read_policy_store+0x3e/0x12d [btrfs]
> [ 173.555541] ? kobj_attr_store+0x16/0x30
> [ 173.555562] ? sysfs_kf_write+0x54/0x80
> [ 173.555582] ? kernfs_fop_write+0xfa/0x290
> [ 173.555611] ? vfs_write+0xee/0x2f0
> [ 173.555641] ? ksys_write+0x80/0x170
> [ 173.555671] ? __x64_sys_write+0x1e/0x30
> [ 173.555692] ? do_syscall_64+0x4b/0x80
> [ 173.555708] ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
>
>
> static ssize_t kernfs_fop_write(struct file *file, const char __user
> *user_buf,
> size_t count, loff_t *ppos)
> {
> ::
> buf[len] = '\0'; /* guarantee string termination */
Ok thanks.
next prev parent reply other threads:[~2020-10-29 19:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 13:14 [PATCH v10 resend 0/3] readmirror feature (read_policy sysfs and in-memory only approach) Anand Jain
2020-10-28 13:14 ` [PATCH v10 1/3] btrfs: add btrfs_strmatch helper Anand Jain
2020-10-29 18:35 ` David Sterba
2020-10-28 13:14 ` [PATCH v10 2/3] btrfs: create read policy framework Anand Jain
2020-10-29 18:53 ` David Sterba
2020-10-28 13:14 ` [PATCH v10 3/3] btrfs: create read policy sysfs attribute, pid Anand Jain
2020-10-29 16:45 ` David Sterba
2020-10-29 19:30 ` Anand Jain
2020-10-29 19:30 ` David Sterba [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-10-28 4:25 [PATCH v10 0/3] readmirror feature (read_policy sysfs and in-memory only approach) Anand Jain
2020-10-28 4:25 ` [PATCH v10 3/3] btrfs: create read policy sysfs attribute, pid 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=20201029193018.GT6756@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=anand.jain@oracle.com \
--cc=josef@toxicpanda.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).