Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: benjamin@sipsolutions.net, linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com
Cc: oe-kbuild-all@lists.linux.dev,
	Johannes Berg <johannes@sipsolutions.net>,
	Benjamin Berg <benjamin.berg@intel.com>
Subject: Re: [PATCH 2/3] kunit: add ability to register a simple cleanup function
Date: Tue, 11 Apr 2023 23:28:57 +0800	[thread overview]
Message-ID: <202304112307.LAyTVYon-lkp@intel.com> (raw)
In-Reply-To: <20230329172311.71861-2-benjamin@sipsolutions.net>

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master v6.3-rc6 next-20230411]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/benjamin-sipsolutions-net/kunit-add-ability-to-register-a-simple-cleanup-function/20230330-012515
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20230329172311.71861-2-benjamin%40sipsolutions.net
patch subject: [PATCH 2/3] kunit: add ability to register a simple cleanup function
config: arc-randconfig-m031-20230410 (https://download.01.org/0day-ci/archive/20230411/202304112307.LAyTVYon-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304112307.LAyTVYon-lkp@intel.com/

New smatch warnings:
lib/kunit/test.c:750 kunit_add_cleanup() error: potential null dereference 'res'.  (kzalloc returns null)
lib/kunit/test.c:750 kunit_add_cleanup() error: we previously assumed 'res' could be null (see line 745)

Old smatch warnings:
lib/kunit/test.c:293 kunit_abort() warn: ignoring unreachable code.

vim +/res +750 lib/kunit/test.c

   735	
   736	void kunit_add_cleanup(struct kunit *test, kunit_cleanup_t cleanup_func,
   737			       const void *data, gfp_t internal_gfp)
   738	{
   739		struct kunit_auto_cleanup *res;
   740	
   741		KUNIT_ASSERT_NOT_NULL_MSG(test, cleanup_func,
   742					  "Cleanup function must not be NULL");
   743	
   744		res = kzalloc(sizeof(*res), internal_gfp);
 > 745		if (!res) {
   746			cleanup_func(data);
   747			KUNIT_ASSERT_FAILURE(test, "Could not allocate resource for cleanup");
   748		}
   749	
 > 750		res->cleanup_func = cleanup_func;
   751		res->resource.should_kfree = true;
   752	
   753		/* Cannot fail as init is NULL */
   754		__kunit_add_resource(test, NULL, kunit_auto_cleanup_free,
   755				     &res->resource, (void *)data);
   756	}
   757	EXPORT_SYMBOL_GPL(kunit_add_cleanup);
   758	

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

  parent reply	other threads:[~2023-04-11 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 17:23 [PATCH 1/3] kunit: add parameter generation macro using description from array benjamin
2023-03-29 17:23 ` [PATCH 2/3] kunit: add ability to register a simple cleanup function benjamin
2023-03-30  6:17   ` David Gow
2023-03-30  7:14     ` Benjamin Berg
2023-04-11 15:28   ` kernel test robot [this message]
2023-03-29 17:23 ` [PATCH 3/3] kunit: add a convenience allocation wrapper for SKBs benjamin

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=202304112307.LAyTVYon-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=benjamin.berg@intel.com \
    --cc=benjamin@sipsolutions.net \
    --cc=johannes@sipsolutions.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox