From: <dan.carpenter@oracle.com>
To: dhowells@redhat.com
Cc: linux-fsdevel@vger.kernel.org
Subject: [bug report] fsinfo: Allow fsinfo() to look up a mount object by ID
Date: Mon, 13 Jul 2020 13:12:22 +0300 [thread overview]
Message-ID: <20200713101222.GA246269@mwanda> (raw)
Hello David Howells,
The patch 2421474bbbc8: "fsinfo: Allow fsinfo() to look up a mount
object by ID" from Jul 5, 2019, leads to the following static checker
warning:
fs/fsinfo.c:618 vfs_fsinfo_mount()
warn: AAA no lower bound on 'mnt_id'
fs/fsinfo.c
589 static int vfs_fsinfo_mount(int dfd, const char __user *filename,
590 struct fsinfo_context *ctx)
591 {
592 struct path path;
593 struct fd f = {};
594 char *name;
595 long mnt_id;
^^^^^^^^^^^
596 int ret;
597
598 if (!filename)
599 return -EINVAL;
600
601 name = strndup_user(filename, 32);
602 if (IS_ERR(name))
603 return PTR_ERR(name);
604 ret = kstrtoul(name, 0, &mnt_id);
605 if (ret < 0)
606 goto out_name;
607 if (mnt_id > INT_MAX)
^^^^^^^^^^^^^^^^
This can be negative. Why do we need to check this at all? Can we just
delete this check?
608 goto out_name;
609
610 if (dfd != AT_FDCWD) {
611 ret = -EBADF;
612 f = fdget_raw(dfd);
613 if (!f.file)
614 goto out_name;
615 }
616
617 ret = lookup_mount_object(f.file ? &f.file->f_path : NULL,
618 mnt_id, &path);
619 if (ret < 0)
620 goto out_fd;
621
622 ret = vfs_fsinfo(&path, ctx);
623 path_put(&path);
624 out_fd:
625 fdput(f);
626 out_name:
627 kfree(name);
628 return ret;
629 }
regards,
dan carpenter
next reply other threads:[~2020-07-13 10:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 10:12 dan.carpenter [this message]
2020-07-17 17:31 ` [bug report] fsinfo: Allow fsinfo() to look up a mount object by ID David Howells
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=20200713101222.GA246269@mwanda \
--to=dan.carpenter@oracle.com \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@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.