All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: shrinkers: fix minmax.cocci warnings
  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
  2022-06-03 13:10 ` [PATCH] mm: shrinkers: fix stream_open.cocci warnings kernel test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-06-03 13:10 UTC (permalink / raw)
  To: kbuild

[-- 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))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] mm: shrinkers: fix stream_open.cocci warnings
  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 ` [PATCH] mm: shrinkers: fix minmax.cocci warnings kernel test robot
@ 2022-06-03 13:10 ` kernel test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-06-03 13:10 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1360 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:105:8-24: WARNING: shrinker_debugfs_scan_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.

Generated by: scripts/coccinelle/api/stream_open.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
@@ -102,7 +102,7 @@ DEFINE_SHOW_ATTRIBUTE(shrinker_debugfs_c
 static int shrinker_debugfs_scan_open(struct inode *inode, struct file *file)
 {
 	file->private_data = inode->i_private;
-	return nonseekable_open(inode, file);
+	return stream_open(inode, file);
 }
 
 static ssize_t shrinker_debugfs_scan_write(struct file *file,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [rgushchin:shrinker.5 7/9] mm/shrinker_debug.c:120:21-22: WARNING opportunity for min()
@ 2022-06-03 13:11 kernel test robot
  2022-06-03 13:10 ` [PATCH] mm: shrinkers: fix minmax.cocci warnings kernel test robot
  2022-06-03 13:10 ` [PATCH] mm: shrinkers: fix stream_open.cocci warnings kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: kernel test robot @ 2022-06-03 13:11 UTC (permalink / raw)
  To: kbuild

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

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

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
config: x86_64-randconfig-c022 (https://download.01.org/0day-ci/archive/20220603/202206032155.W0MZ4A1a-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> mm/shrinker_debug.c:120:21-22: WARNING opportunity for min()
--
>> mm/shrinker_debug.c:105:8-24: WARNING: shrinker_debugfs_scan_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.

Please review and possibly fold the followup patch.

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] mm: shrinkers: fix stream_open.cocci warnings
  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 ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-05-07  8:34 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
TO: Roman Gushchin <guro@fb.com>

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

mm/shrinker_debug.c:107:8-24: WARNING: shrinker_debugfs_scan_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.

Generated by: scripts/coccinelle/api/stream_open.cocci

Fixes: 12f77aac7ef2 ("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.3
head:   12f77aac7ef21be765e90bb8e0b611e6b9085256
commit: 12f77aac7ef21be765e90bb8e0b611e6b9085256 [7/7] mm: shrinkers: add scan interface for shrinker debugfs
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours 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
@@ -104,7 +104,7 @@ DEFINE_SHOW_ATTRIBUTE(shrinker_debugfs_c
 static int shrinker_debugfs_scan_open(struct inode *inode, struct file *file)
 {
 	file->private_data = inode->i_private;
-	return nonseekable_open(inode, file);
+	return stream_open(inode, file);
 }
 
 static ssize_t shrinker_debugfs_scan_write(struct file *file,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-03 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH] mm: shrinkers: fix minmax.cocci warnings kernel test robot
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 stream_open.cocci warnings kernel test robot

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.