All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [bug report] fanotify: record name info for FAN_DIR_MODIFY event
Date: Tue, 16 Nov 2021 21:01:46 +0300	[thread overview]
Message-ID: <20211116180146.GK27562@kadam> (raw)
In-Reply-To: <20211116175709.GJ27562@kadam>

On Tue, Nov 16, 2021 at 08:57:09PM +0300, Dan Carpenter wrote:
> On Tue, Nov 16, 2021 at 05:21:34PM +0200, Amir Goldstein wrote:
> > On Tue, Nov 16, 2021 at 1:45 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > >
> > > Hello Amir Goldstein,
> > >
> > > The patch cacfb956d46e: "fanotify: record name info for
> > > FAN_DIR_MODIFY event" from Mar 19, 2020, leads to the following
> > > Smatch static checker warning:
> > >
> > >         fs/notify/fanotify/fanotify_user.c:401 copy_fid_info_to_user()
> > >         error: we previously assumed 'fh' could be null (see line 362)
> > >
> > > fs/notify/fanotify/fanotify_user.c
> > >     354 static int copy_fid_info_to_user(__kernel_fsid_t *fsid, struct fanotify_fh *fh,
> > >     355                                  int info_type, const char *name,
> > >     356                                  size_t name_len,
> > >     357                                  char __user *buf, size_t count)
> > >     358 {
> > >     359         struct fanotify_event_info_fid info = { };
> > >     360         struct file_handle handle = { };
> > >     361         unsigned char bounce[FANOTIFY_INLINE_FH_LEN], *fh_buf;
> > >     362         size_t fh_len = fh ? fh->len : 0;
> > >                                 ^^^^^^^^^^^^^
> > > The patch adds a check for in "fh" is NULL
> > >
> > >     363         size_t info_len = fanotify_fid_info_len(fh_len, name_len);
> > >     364         size_t len = info_len;
> > >     365
> > >     366         pr_debug("%s: fh_len=%zu name_len=%zu, info_len=%zu, count=%zu\n",
> > >     367                  __func__, fh_len, name_len, info_len, count);
> > >     368
> > 
> > Upstream has these two lines:
> >        if (!fh_len)
> >                 return 0;
> > 
> > Which diffuses the reported bug.
> > Where did those lines go?
> 
> I'm not sure, I suspected this might be a merge issue.

Oh, duh.  I'm using linux-next.  Probably that's relevant information.

regards,
dan carpenter


  reply	other threads:[~2021-11-16 18:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 11:45 [bug report] fanotify: record name info for FAN_DIR_MODIFY event Dan Carpenter
2021-11-16 15:21 ` Amir Goldstein
2021-11-16 17:57   ` Dan Carpenter
2021-11-16 18:01     ` Dan Carpenter [this message]
2021-11-16 18:30       ` Amir Goldstein

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=20211116180146.GK27562@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=amir73il@gmail.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.