From: Dan Carpenter <dan.carpenter@oracle.com>
To: s.mesoraca16@gmail.com
Cc: linux-fsdevel@vger.kernel.org
Subject: [bug report] namei: allow restricted O_CREAT of FIFOs and regular files
Date: Thu, 26 Apr 2018 11:14:56 +0300 [thread overview]
Message-ID: <20180426081456.GA7060@mwanda> (raw)
Hello Salvatore Mesoraca,
The patch 0d70abf05029: "namei: allow restricted O_CREAT of FIFOs and
regular files" from Apr 23, 2018, leads to the following static
checker warning:
fs/namei.c:3390 do_last()
error: uninitialized symbol 'inode'.
fs/namei.c
3250 static int do_last(struct nameidata *nd,
3251 struct file *file, const struct open_flags *op,
3252 int *opened)
3253 {
3254 struct dentry *dir = nd->path.dentry;
3255 int open_flag = op->open_flag;
3256 bool will_truncate = (open_flag & O_TRUNC) != 0;
3257 bool got_write = false;
3258 int acc_mode = op->acc_mode;
3259 unsigned seq;
3260 struct inode *inode;
^^^^^
3261 struct path path;
3262 int error;
3263
3264 nd->flags &= ~LOOKUP_PARENT;
3265 nd->flags |= op->intent;
3266
3267 if (nd->last_type != LAST_NORM) {
3268 error = handle_dots(nd, nd->last_type);
3269 if (unlikely(error))
3270 return error;
3271 goto finish_open;
^^^^^^^^^^^^^^^^
3272 }
[ snip ]
3380 finish_open:
3381 /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */
3382 error = complete_walk(nd);
3383 if (error)
3384 return error;
3385 audit_inode(nd->name, nd->path.dentry, 0);
3386 if (open_flag & O_CREAT) {
3387 error = -EISDIR;
3388 if (d_is_dir(nd->path.dentry))
3389 goto out;
3390 error = may_create_in_sticky(dir, inode);
^^^^^
3391 if (unlikely(error))
3392 goto out;
3393 }
3394 error = -ENOTDIR;
3395 if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry))
3396 goto out;
3397 if (!d_is_reg(nd->path.dentry))
3398 will_truncate = false;
3399
3400 if (will_truncate) {
3401 error = mnt_want_write(nd->path.mnt);
3402 if (error)
3403 goto out;
3404 got_write = true;
3405 }
regards,
dan carpenter
next reply other threads:[~2018-04-26 8:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 8:14 Dan Carpenter [this message]
2018-04-26 17:28 ` [bug report] namei: allow restricted O_CREAT of FIFOs and regular files Salvatore Mesoraca
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=20180426081456.GA7060@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=s.mesoraca16@gmail.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.