[jj-apparmor:apparmor-next 14/14] security/apparmor/net.c:320:41: warning: address of 'needput' will always evaluate to 'true'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,dev.linux.lists.llvm
Message-ID <[email protected]>
Hi John,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git apparmor-next
head:   bbb153c86dafaa6497b8a0a5372d1e79be8a7617
commit: bbb153c86dafaa6497b8a0a5372d1e79be8a7617 [14/14] apparmor: optimize current_label_crit_section() with needput
config: x86_64-randconfig-001-20260808 (https://download.01.org/0day-ci/archive/20260809/[email protected]/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260809/[email protected]/reproduce)

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> security/apparmor/net.c:320:41: warning: address of 'needput' will always evaluate to 'true' [-Wpointer-bool-conversion]
     320 |         end_current_label_crit_section(label, &needput);
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~         ^~~~~~~
   1 warning generated.


vim +320 security/apparmor/net.c

   307	
   308	int aa_sk_perm(const char *op, u32 request, struct sock *sk)
   309	{
   310		struct aa_label *label;
   311		bool needput;
   312		int error;
   313	
   314		AA_BUG(!sk);
   315		AA_BUG(in_interrupt());
   316	
   317		/* TODO: switch to begin_current_label ???? */
   318		label = begin_current_label_crit_section(&needput);
   319		error = aa_label_sk_perm(current_cred(), label, op, request, sk);
 > 320		end_current_label_crit_section(label, &needput);
   321	
   322		return error;
   323	}
   324	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.