All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [PATCH] mm: shrinkers: fix minmax.cocci warnings
Date: Fri, 03 Jun 2022 21:10:11 +0800	[thread overview]
Message-ID: <YpoIM9f1DJqYydJJ@c8453bd35dbf> (raw)
In-Reply-To: <202206032155.W0MZ4A1a-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
TO: Roman Gushchin <roman.gushchin@linux.dev>

From: kernel test robot <lkp@intel.com>

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 debugfs")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://github.com/rgushchin/linux.git shrinker.5
head:   be0b94668aac83e3bc04f73b06ad0b309bd51477
commit: 44d87615ffe3c376b23b6087b0b1fa02a3f86b62 [7/9] mm: shrinkers: add scan 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 = NULL;
 	int nid;
 	char kbuf[72];
-	int read_len = size < (sizeof(kbuf) - 1) ? size : (sizeof(kbuf) - 1);
+	int read_len = min(size, sizeof(kbuf) - 1);
 	ssize_t ret;
 
 	if (copy_from_user(kbuf, buf, read_len))

  reply	other threads:[~2022-06-03 13:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 13:11 [rgushchin:shrinker.5 7/9] mm/shrinker_debug.c:120:21-22: WARNING opportunity for min() kernel test robot
2022-06-03 13:10 ` kernel test robot [this message]
2022-06-03 13:10 ` [PATCH] mm: shrinkers: fix stream_open.cocci warnings kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-05-07  8:46 [rgushchin:shrinker.3 7/7] mm/shrinker_debug.c:122:21-22: WARNING opportunity for min() kernel test robot
2022-05-07  8:34 ` [PATCH] mm: shrinkers: fix minmax.cocci warnings kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YpoIM9f1DJqYydJJ@c8453bd35dbf \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.