From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4194470457182296253==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] xfs: fix minmax.cocci warnings Date: Wed, 13 Apr 2022 16:42:30 +0800 Message-ID: In-Reply-To: <202204131616.aL0AP4y5-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============4194470457182296253== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com CC: "Darrick J. Wong" CC: linux-kernel(a)vger.kernel.org TO: "Darrick J. Wong" CC: linux-xfs(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot 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 Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.gi= t vectorized-scrub head: bd756ef7af68274b79308166ee64949d288be861 commit: 891c7be4c3972763fb1566587858223ff2019f81 [194/396] xfs: add a ->xch= g_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 =3D res->ip2_rtbcount - res->ip1_rtbcount; if (ddelta > 0 || rdelta > 0) { error =3D 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 =3D=3D -EDQUOT || error =3D=3D -ENOSPC) { /* --===============4194470457182296253==--