From: Al Viro <viro@ZenIV.linux.org.uk>
To: Vasyl Gomonovych <gomonovych@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/seq_file: Fix warning of passing zero to 'PTR_ERR'
Date: Thu, 7 Dec 2017 23:26:04 +0000 [thread overview]
Message-ID: <20171207232603.GJ21978@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20171207232326.GI21978@ZenIV.linux.org.uk>
On Thu, Dec 07, 2017 at 11:23:26PM +0000, Al Viro wrote:
> On Fri, Dec 08, 2017 at 12:03:07AM +0100, Vasyl Gomonovych wrote:
> > p could be NULL and passing into PTR_ERR
> >
> > Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
> > ---
> > fs/seq_file.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/seq_file.c b/fs/seq_file.c
> > index 4be761c..8b700b9 100644
> > --- a/fs/seq_file.c
> > +++ b/fs/seq_file.c
> > @@ -262,8 +262,8 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
> > size_t offs = m->count;
> > loff_t next = pos;
> > p = m->op->next(m, p, &next);
> > - if (!p || IS_ERR(p)) {
> > - err = PTR_ERR(p);
> > + if (IS_ERR(p)) {
> > + err = (!p ? -EFAULT : PTR_ERR(p));
>
> What does it fix, if I might ask? And while we are at it, would
> you mind explaining the reasoning behind that change? Or, say,
> testing done to it...
While we are at it, where has that -EFAULT come from? And how
would it be ever reached, seeing that IS_ERR(NULL) is false?
next prev parent reply other threads:[~2017-12-07 23:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 23:03 [PATCH] fs/seq_file: Fix warning of passing zero to 'PTR_ERR' Vasyl Gomonovych
2017-12-07 23:20 ` Matthew Wilcox
2017-12-07 23:23 ` Al Viro
2017-12-07 23:26 ` Al Viro [this message]
2017-12-08 7:54 ` Gomonovych, Vasyl
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=20171207232603.GJ21978@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=gomonovych@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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).