Thread (66 messages) 66 messages, 3 authors, 2025-10-23

Re: [PATCH v2 10/63] ns: add active reference count

From: kernel test robot <hidden>
Date: 2025-10-23 07:30:15
Also in: bpf, cgroups, linux-fsdevel, lkml, llvm, oe-kbuild-all

Hi Christian,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 3a8660878839faadb4f1a6dd72c3179c1df56787]

url:    https://github.com/intel-lab-lkp/linux/commits/Christian-Brauner/libfs-allow-to-specify-s_d_flags/20251023-004014
base:   3a8660878839faadb4f1a6dd72c3179c1df56787
patch link:    https://lore.kernel.org/r/20251022-work-namespace-nstree-listns-v2-10-71a588572371%40kernel.org
patch subject: [PATCH v2 10/63] ns: add active reference count
config: i386-buildonly-randconfig-001-20251023 (https://download.01.org/0day-ci/archive/20251023/202510231548.kt6wvifE-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251023/202510231548.kt6wvifE-lkp@intel.com/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 [off-list ref]
| Closes: https://lore.kernel.org/oe-kbuild-all/202510231548.kt6wvifE-lkp@intel.com/ (local)

All warnings (new ones prefixed by >>):
quoted
kernel/cred.c:313:21: warning: variable 'new' is uninitialized when used here [-Wuninitialized]
     313 |                 ns_ref_active_get(new->user_ns);
         |                                   ^~~
   include/linux/ns_common.h:258:11: note: expanded from macro 'ns_ref_active_get'
     258 |         do { if (__ns) __ns_ref_active_get(to_ns_common(__ns)); } while (0)
         |                  ^~~~
   kernel/cred.c:292:18: note: initialize the variable 'new' to silence this warning
     292 |         struct cred *new;
         |                         ^
         |                          = NULL
   1 warning generated.


vim +/new +313 kernel/cred.c

   298	
   299		if (
   300	#ifdef CONFIG_KEYS
   301			!p->cred->thread_keyring &&
   302	#endif
   303			clone_flags & CLONE_THREAD
   304		    ) {
   305			p->real_cred = get_cred_many(p->cred, 2);
   306			kdebug("share_creds(%p{%ld})",
   307			       p->cred, atomic_long_read(&p->cred->usage));
   308			inc_rlimit_ucounts(task_ucounts(p), UCOUNT_RLIMIT_NPROC, 1);
   309			/*
   310			 * Each task gets its own active reference, even if
   311			 * CLONE_THREAD shares the cred structure.
   312			 */
 > 313			ns_ref_active_get(new->user_ns);
   314			return 0;
   315		}
   316	
   317		new = prepare_creds();
   318		if (!new)
   319			return -ENOMEM;
   320	
   321		if (clone_flags & CLONE_NEWUSER) {
   322			ret = create_user_ns(new);
   323			if (ret < 0)
   324				goto error_put;
   325			ret = set_cred_ucounts(new);
   326			if (ret < 0)
   327				goto error_put;
   328		}
   329	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help