From: Dan Carpenter <dan.carpenter@oracle.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Matthew Bobrowski <repnop@google.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [bug report] fanotify: fix copy_event_to_user() fid error clean up
Date: Thu, 22 Jul 2021 12:31:42 +0300 [thread overview]
Message-ID: <20210722093142.GU25548@kadam> (raw)
In-Reply-To: <CAOQ4uxgLZTTYV9h4SkCwYEm9D+Nd4VX5MbX8e-fUprsLOdPS2w@mail.gmail.com>
On Thu, Jul 22, 2021 at 12:01:41PM +0300, Amir Goldstein wrote:
> On Thu, Jul 22, 2021 at 1:39 AM Matthew Bobrowski <repnop@google.com> wrote:
> > To make things clearer, avoid any future confusion and possibly tripping
> > over such a bug, perhaps it'd be better to split up the fput(f) call into a
> > separate branch outside of the current conditional, simply i.e.
> >
> > ...
> >
> > if (f)
> > fput(f);
> >
> > ...
> >
> > Thoughts?
>
> smatch (apparently) does not know about the relation that f is non NULL
> if (fd == FAN_NOFD) it needs to study create_fd() for that.
>
> I suggest to move fd_install(fd, f); right after checking of return value
> from create_fd() and without the if (f) condition.
> That should make it clear for human and robots reading this function
> that the cleanup in out_close_fd label is correct.
Yeah. I got "f" and "fd" mixed up in my head when I was reviewing this
code. My bad.
Smatch is *supposed* to know about the relationship between those two.
The bug is actually that Smatch records in the database that create_fd()
always fails. It's a serious bug, and I'm trying to investigate what's
going on and I'm sure that I will fix this before the end of the week.
No need to change the code just to work around a static checker bug.
regards,
dan carpenter
next prev parent reply other threads:[~2021-07-22 9:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-21 12:54 [bug report] fanotify: fix copy_event_to_user() fid error clean up Dan Carpenter
2021-07-21 22:38 ` Matthew Bobrowski
2021-07-22 9:01 ` Amir Goldstein
2021-07-22 9:31 ` Dan Carpenter [this message]
2021-07-22 14:01 ` Dan Carpenter
2021-07-22 23:13 ` Matthew Bobrowski
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=20210722093142.GU25548@kadam \
--to=dan.carpenter@oracle.com \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=repnop@google.com \
/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.