From: kernel test robot <lkp@intel.com>
To: Christian Brauner <brauner@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>
Subject: [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: Wed, 4 Oct 2023 14:20:42 +0800 [thread overview]
Message-ID: <202310041442.iukUNRze-lkp@intel.com> (raw)
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@intel.com/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@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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310041442.iukUNRze-lkp@intel.com/
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
reply other threads:[~2023-10-04 6:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202310041442.iukUNRze-lkp@intel.com \
--to=lkp@intel.com \
--cc=brauner@kernel.org \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).