From: Dan Carpenter <dan.carpenter@oracle.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Amir Goldstein <amir73il@gmail.com>,
overlayfs <linux-unionfs@vger.kernel.org>
Subject: Re: [bug report] ovl: make sure that real fid is 32bit aligned in memory
Date: Fri, 13 Dec 2019 15:58:28 +0300 [thread overview]
Message-ID: <20191213125828.GE2407@kadam> (raw)
In-Reply-To: <CAJfpegv1d=XRcqD0yJpobP2j3F+gBbKhmJ2mUzwq33s=4gD4Bw@mail.gmail.com>
On Fri, Dec 13, 2019 at 01:22:10PM +0100, Miklos Szeredi wrote:
> On Fri, Dec 13, 2019 at 11:38 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > Hello Amir Goldstein,
> >
> > This is a semi-automatic email about new static checker warnings.
> >
> > The patch cbe7fba8edfc: "ovl: make sure that real fid is 32bit
> > aligned in memory" from Nov 15, 2019, leads to the following Smatch
> > complaint:
> >
> > fs/overlayfs/copy_up.c:338 ovl_set_origin()
> > warn: variable dereferenced before check 'fh' (see line 337)
> >
> > fs/overlayfs/copy_up.c
> > 336 */
> > 337 err = ovl_check_setxattr(dentry, upper, OVL_XATTR_ORIGIN, fh->buf,
> > ^^^^^^^
> > The patch adds an unconditional dereference
>
> But in fact fh->buf is not a dereference:
>
> struct ovl_fh {
> u8 padding[3]; /* make sure fb.fid is 32bit aligned */
> union {
> struct ovl_fb fb;
> u8 buf[0];
> };
> } __packed;
>
> Subsequent code will also not dereference fh->buf, because the
> supplied size is zero.
Ah yes. Thanks. Smatch got confused because the array is inside a
union. Sorry.
regards,
dan carpenter
next prev parent reply other threads:[~2019-12-13 12:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 10:37 [bug report] ovl: make sure that real fid is 32bit aligned in memory Dan Carpenter
2019-12-13 12:22 ` Miklos Szeredi
2019-12-13 12:58 ` Dan Carpenter [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-05-05 13:50 Dan Carpenter
2020-05-05 16:13 ` Amir Goldstein
2020-05-05 18:08 ` Dan Carpenter
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=20191213125828.GE2407@kadam \
--to=dan.carpenter@oracle.com \
--cc=amir73il@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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