From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8837931139261535114==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Mon, 21 Mar 2022 19:54:44 +0800 Message-ID: <20220321115444.GA26768@7f8e4d2b28a4> In-Reply-To: <202203211936.Ym0Bumni-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============8837931139261535114== 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: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Thomas Bogendoerfer CC: linux-mips(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot arch/mips/sibyte/common/sb_tbprof.c:462:19-20: WARNING opportunity for min() 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 CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: f443e374ae131c168a065ea1748feac6b2e76613 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 16 hours ago :::::: commit date: 11 months ago Please take the patch only if it's a positive warning. Thanks! arch/mips/sibyte/common/sb_tbprof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/sibyte/common/sb_tbprof.c +++ b/arch/mips/sibyte/common/sb_tbprof.c @@ -459,7 +459,7 @@ static ssize_t sbprof_tb_read(struct fil while (size && (cur_sample < sbp.next_tb_sample)) { int err; = - cur_count =3D size < sample_left ? size : sample_left; + cur_count =3D min(size, sample_left); src =3D (char *)(((long)sbp.sbprof_tbbuf[cur_sample])+sample_off); err =3D __copy_to_user(dest, src, cur_count); if (err) { --===============8837931139261535114==--