linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 2720/3921] lib/alloc_tag.c:142 alloc_tag_init() warn: passing zero to 'PTR_ERR'
@ 2024-04-05  6:51 Dan Carpenter
  2024-04-16 23:57 ` Suren Baghdasaryan
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-04-05  6:51 UTC (permalink / raw)
  To: oe-kbuild, Suren Baghdasaryan
  Cc: lkp, oe-kbuild-all, Linux Memory Management List, Andrew Morton,
	Kent Overstreet

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8568bb2ccc278f344e6ac44af6ed010a90aa88dc
commit: 9e2dcefa791e9d14006b360fba3455510fd3325d [2720/3921] lib: add allocation tagging support for memory allocation profiling
config: microblaze-randconfig-r081-20240405 (https://download.01.org/0day-ci/archive/20240405/202404051340.7Wo7oiJ5-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202404051340.7Wo7oiJ5-lkp@intel.com/

smatch warnings:
lib/alloc_tag.c:142 alloc_tag_init() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +142 lib/alloc_tag.c

9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  132  static int __init alloc_tag_init(void)
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  133  {
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  134  	const struct codetag_type_desc desc = {
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  135  		.section	= "alloc_tags",
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  136  		.tag_size	= sizeof(struct alloc_tag),
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  137  		.module_unload	= alloc_tag_module_unload,
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  138  	};
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  139  
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  140  	alloc_tag_cttype = codetag_register_type(&desc);
9e2dcefa791e9d Suren Baghdasaryan 2024-03-21  141  	if (IS_ERR_OR_NULL(alloc_tag_cttype))
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This should just be IS_ERR().  I have written a blog that has more
details:

https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/

9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 @142  		return PTR_ERR(alloc_tag_cttype);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



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

end of thread, other threads:[~2024-04-17  0:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-05  6:51 [linux-next:master 2720/3921] lib/alloc_tag.c:142 alloc_tag_init() warn: passing zero to 'PTR_ERR' Dan Carpenter
2024-04-16 23:57 ` Suren Baghdasaryan
2024-04-17  0:36   ` Suren Baghdasaryan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox