[linux-next:master 8396/9381] arch/powerpc/platforms/cell/spufs/coredump.c:79:6: warning: variable 'ctx' is used uninitialized whenever 'if' condition is false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   c9f2baaa18b5ea8f006a2b3a616da9597c71d15e
commit: af66b51563ad7e625602809a0f4c45154df063d1 [8396/9381] file: convert to SLAB_TYPESAFE_BY_RCU
config: powerpc64-allyesconfig (https://download.01.org/0day-ci/archive/20231004/202310041442.iukUNRze-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231004/202310041442.iukUNRze-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310041442.iukUNRze-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> arch/powerpc/platforms/cell/spufs/coredump.c:79:6: warning: variable 'ctx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      79 |         if (file) {
         |             ^~~~
   arch/powerpc/platforms/cell/spufs/coredump.c:85:9: note: uninitialized use occurs here
      85 |         return ctx;
         |                ^~~
   arch/powerpc/platforms/cell/spufs/coredump.c:79:2: note: remove the 'if' if its condition is always true
      79 |         if (file) {
         |         ^~~~~~~~~~
   arch/powerpc/platforms/cell/spufs/coredump.c:69:25: note: initialize the variable 'ctx' to silence this warning
      69 |         struct spu_context *ctx;
         |                                ^
         |                                 = NULL
   1 warning generated.


vim +79 arch/powerpc/platforms/cell/spufs/coredump.c

    54	
    55	/*
    56	 * The additional architecture-specific notes for Cell are various
    57	 * context files in the spu context.
    58	 *
    59	 * This function iterates over all open file descriptors and sees
    60	 * if they are a directory in spufs.  In that case we use spufs
    61	 * internal functionality to dump them without needing to actually
    62	 * open the files.
    63	 */
    64	/*
    65	 * descriptor table is not shared, so files can't change or go away.
    66	 */
    67	static struct spu_context *coredump_next_context(int *fd)
    68	{
    69		struct spu_context *ctx;
    70		struct file *file;
    71		int n = iterate_fd(current->files, *fd, match_context, NULL);
    72		if (!n)
    73			return NULL;
    74		*fd = n - 1;
    75	
    76		rcu_read_lock();
    77		file = lookup_fdget_rcu(*fd);
    78		rcu_read_unlock();
  > 79		if (file) {
    80			ctx = SPUFS_I(file_inode(file))->i_ctx;
    81			get_spu_context(ctx);
    82			fput(file);
    83		}
    84	
    85		return ctx;
    86	}
    87	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux