From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] xfs: fix minmax.cocci warnings
Date: Wed, 13 Apr 2022 16:42:30 +0800 [thread overview]
Message-ID: <YlaM9ma3NlFtCGGe@beab94c2fae7> (raw)
In-Reply-To: <202204131616.aL0AP4y5-lkp@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1741 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: "Darrick J. Wong" <darrick.wong@oracle.com>
CC: linux-kernel(a)vger.kernel.org
TO: "Darrick J. Wong" <djwong@kernel.org>
CC: linux-xfs(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
From: kernel test robot <lkp@intel.com>
fs/xfs/xfs_xchgrange.c:188:11-12: WARNING opportunity for max()
fs/xfs/xfs_xchgrange.c:189:11-12: WARNING opportunity for max()
Check for opencoded min(), max() implementations.
Generated patches sometimes require adding a cast to fix compile warning.
Warnings/patches scope intentionally limited to a function body.
Generated by: scripts/coccinelle/misc/minmax.cocci
Fixes: 891c7be4c397 ("xfs: add a ->xchg_file_range handler")
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/djwong/xfs-linux.git vectorized-scrub
head: bd756ef7af68274b79308166ee64949d288be861
commit: 891c7be4c3972763fb1566587858223ff2019f81 [194/396] xfs: add a ->xchg_file_range handler
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
Please take the patch only if it's a positive warning. Thanks!
fs/xfs/xfs_xchgrange.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/xfs/xfs_xchgrange.c
+++ b/fs/xfs/xfs_xchgrange.c
@@ -185,8 +185,8 @@ xfs_xchg_range_reserve_quota(
rdelta = res->ip2_rtbcount - res->ip1_rtbcount;
if (ddelta > 0 || rdelta > 0) {
error = xfs_trans_reserve_quota_nblks(tp, req->ip1,
- ddelta > 0 ? ddelta : 0,
- rdelta > 0 ? rdelta : 0,
+ max(ddelta, 0),
+ max(rdelta, 0),
false);
if (error == -EDQUOT || error == -ENOSPC) {
/*
next prev parent reply other threads:[~2022-04-13 8:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 8:47 [djwong-xfs:vectorized-scrub 194/396] fs/xfs/xfs_xchgrange.c:188:11-12: WARNING opportunity for max() kernel test robot
2022-04-13 8:42 ` kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-06-04 16:58 [djwong-xfs:vectorized-scrub 199/401] " kernel test robot
2022-06-04 16:47 ` [PATCH] xfs: fix minmax.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=YlaM9ma3NlFtCGGe@beab94c2fae7 \
--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.