From: kernel test robot <lkp@intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Xu Yilun <yilun.xu@linux.intel.com>
Subject: [djbw:devsec-20240829 5/6] drivers/pci/tsm.c:215:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false
Date: Mon, 2 Sep 2024 18:04:34 +0800 [thread overview]
Message-ID: <202409021701.f3Xpx5wU-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djbw/linux.git devsec-20240829
head: c412ecb5794c43513093a92b3730389cfd76e17f
commit: 5807465b92acdf29166415fcf35db30572ffa44b [5/6] PCI/TSM: Authenticate devices via platform TSM
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240902/202409021701.f3Xpx5wU-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240902/202409021701.f3Xpx5wU-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/202409021701.f3Xpx5wU-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/pci/tsm.c:215:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
215 | if (tsm_ops)
| ^~~~~~~
drivers/pci/tsm.c:219:19: note: uninitialized use occurs here
219 | for_each_pci_dev(pdev)
| ^~~~
include/linux/pci.h:550:80: note: expanded from macro 'for_each_pci_dev'
550 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
| ^
drivers/pci/tsm.c:215:2: note: remove the 'if' if its condition is always true
215 | if (tsm_ops)
| ^~~~~~~~~~~~
216 | return -EBUSY;
drivers/pci/tsm.c:210:22: note: initialize the variable 'pdev' to silence this warning
210 | struct pci_dev *pdev;
| ^
| = NULL
drivers/pci/tsm.c:250:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
250 | if (ops != tsm_ops)
| ^~~~~~~~~~~~~~
drivers/pci/tsm.c:252:19: note: uninitialized use occurs here
252 | for_each_pci_dev(pdev)
| ^~~~
include/linux/pci.h:550:80: note: expanded from macro 'for_each_pci_dev'
550 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
| ^
drivers/pci/tsm.c:250:2: note: remove the 'if' if its condition is always true
250 | if (ops != tsm_ops)
| ^~~~~~~~~~~~~~~~~~~
251 | return;
drivers/pci/tsm.c:245:22: note: initialize the variable 'pdev' to silence this warning
245 | struct pci_dev *pdev;
| ^
| = NULL
2 warnings generated.
vim +215 drivers/pci/tsm.c
207
208 int pci_tsm_register(const struct pci_tsm_ops *ops, const struct attribute_group *grp)
209 {
210 struct pci_dev *pdev;
211
212 if (!ops)
213 return 0;
214 guard(rwsem_write)(&pci_tsm_rwsem);
> 215 if (tsm_ops)
216 return -EBUSY;
217 tsm_ops = ops;
218 pci_tsm_owner_attr_group = grp;
219 for_each_pci_dev(pdev)
220 __pci_tsm_init(pdev);
221 return 0;
222 }
223 EXPORT_SYMBOL_GPL(pci_tsm_register);
224
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-09-02 10:04 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=202409021701.f3Xpx5wU-lkp@intel.com \
--to=lkp@intel.com \
--cc=dan.j.williams@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=yilun.xu@linux.intel.com \
/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