From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============8413875842267976239==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Thu, 31 Mar 2022 09:54:45 +0800 Message-ID: <20220331015445.GA15758@3a0c58544bbb> In-Reply-To: <202203310917.O9uawonS-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============8413875842267976239== 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: "Greg Kroah-Hartman" CC: Jiri Slaby CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/tty/goldfish.c:95:12-13: 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: 74164d284b2909de0ba13518cc063e9ea9334749 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 8 hours ago :::::: commit date: 11 months ago Please take the patch only if it's a positive warning. Thanks! drivers/tty/goldfish.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -92,7 +92,7 @@ static void goldfish_tty_rw(struct goldf while (addr < addr_end) { unsigned long pg_end =3D (addr & PAGE_MASK) + PAGE_SIZE; unsigned long next =3D - pg_end < addr_end ? pg_end : addr_end; + min(pg_end, addr_end); unsigned long avail =3D next - addr; = /* --===============8413875842267976239==--