All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] ovl: fix bugon.cocci warnings
Date: Tue, 08 Dec 2020 04:35:29 +0800	[thread overview]
Message-ID: <20201207203529.GA45508@c85fcb7603ee> (raw)
In-Reply-To: <202012080455.IPCgCPDV-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Miklos Szeredi <mszeredi@redhat.com>
CC: linux-unionfs(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <lkp@intel.com>

fs/overlayfs/util.c:466:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.
Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)

 Use BUG_ON instead of a if condition followed by BUG.

Semantic patch information:
 This makes an effort to find cases where BUG() follows an if
 condition on an expression and replaces the if condition and BUG()
 with a BUG_ON having the conditional expression of the if statement
 as argument.

Generated by: scripts/coccinelle/misc/bugon.cocci

Fixes: 56230d956739 ("ovl: verify permissions in ovl_path_open()")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0477e92881850d44910a7e94fc2c46f96faa131f
commit: 56230d956739b9cb1cbde439d76227d77979a04d ovl: verify permissions in ovl_path_open()
:::::: branch date: 22 hours ago
:::::: commit date: 6 months ago

Please take the patch only if it's a positive warning. Thanks!

 util.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -462,8 +462,7 @@ struct file *ovl_path_open(struct path *
 	struct inode *inode = d_inode(path->dentry);
 	int err, acc_mode;
 
-	if (flags & ~(O_ACCMODE | O_LARGEFILE))
-		BUG();
+	BUG_ON(flags & ~(O_ACCMODE | O_LARGEFILE));
 
 	switch (flags & O_ACCMODE) {
 	case O_RDONLY:

  reply	other threads:[~2020-12-07 20:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 20:35 fs/overlayfs/util.c:466:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG kernel test robot
2020-12-07 20:35 ` kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-06-03 12:00 [miklos-vfs:overlayfs-next 20/29] " kernel test robot
2020-06-03 12:00 ` [PATCH] ovl: fix bugon.cocci warnings kernel test robot

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=20201207203529.GA45508@c85fcb7603ee \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.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.