From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6600564375766644900==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Fri, 25 Feb 2022 05:33:31 +0800 Message-ID: <20220224213331.GA45315@78549d2db382> In-Reply-To: <202202250530.QlncEEBQ-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============6600564375766644900== 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: 23d04328444a8fa0ca060c5e532220dac8e8bc26 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 25 hours ago :::::: commit date: 10 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; = /* --===============6600564375766644900==--