All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix minmax.cocci warnings
  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
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-04-13  8:42 UTC (permalink / raw)
  To: kbuild

[-- 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) {
 			/*

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [djwong-xfs:vectorized-scrub 194/396] fs/xfs/xfs_xchgrange.c:188:11-12: WARNING opportunity for max()
@ 2022-04-13  8:47 kernel test robot
  2022-04-13  8:42 ` [PATCH] xfs: fix minmax.cocci warnings kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2022-04-13  8:47 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1119 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>

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
config: i386-randconfig-c021 (https://download.01.org/0day-ci/archive/20220413/202204131616.aL0AP4y5-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> fs/xfs/xfs_xchgrange.c:188:11-12: WARNING opportunity for max()
   fs/xfs/xfs_xchgrange.c:189:11-12: WARNING opportunity for max()

Please review and possibly fold the followup patch.

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-13  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH] xfs: fix minmax.cocci warnings kernel test robot

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.