From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0509365860506628297==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] mm: shrinkers: fix minmax.cocci warnings Date: Fri, 03 Jun 2022 21:10:11 +0800 Message-ID: In-Reply-To: <202206032155.W0MZ4A1a-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============0509365860506628297== 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 TO: Roman Gushchin From: kernel test robot mm/shrinker_debug.c:120:21-22: 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 Fixes: 44d87615ffe3 ("mm: shrinkers: add scan interface for shrinker debugf= s") Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://github.com/rgushchin/linux.git shrinker.5 head: be0b94668aac83e3bc04f73b06ad0b309bd51477 commit: 44d87615ffe3c376b23b6087b0b1fa02a3f86b62 [7/9] mm: shrinkers: add s= can interface for shrinker debugfs :::::: branch date: 15 hours ago :::::: commit date: 2 days ago Please take the patch only if it's a positive warning. Thanks! mm/shrinker_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/shrinker_debug.c +++ b/mm/shrinker_debug.c @@ -117,7 +117,7 @@ static ssize_t shrinker_debugfs_scan_wri struct mem_cgroup *memcg =3D NULL; int nid; char kbuf[72]; - int read_len =3D size < (sizeof(kbuf) - 1) ? size : (sizeof(kbuf) - 1); + int read_len =3D min(size, sizeof(kbuf) - 1); ssize_t ret; = if (copy_from_user(kbuf, buf, read_len)) --===============0509365860506628297==--