From: kernel test robot <lkp@intel.com>
To: "Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <helgaas@kernel.org>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Kishon Vijay Abraham I <kishon@ti.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 3/4] PCI/sysfs: Return -EINVAL consistently from "store" functions
Date: Tue, 6 Jul 2021 08:24:00 +0800 [thread overview]
Message-ID: <202107060836.P5flQNoN-lkp@intel.com> (raw)
In-Reply-To: <20210705212308.3050976-3-kw@linux.com>
[-- Attachment #1: Type: text/plain, Size: 7773 bytes --]
Hi "Krzysztof,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on pci/next]
[also build test WARNING on v5.13 next-20210701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Krzysztof-Wilczy-ski/PCI-sysfs-Move-to-kstrtobool-to-handle-user-input/20210706-052334
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: x86_64-randconfig-a011-20210705 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 3f9bf9f42a9043e20c6d2a74dd4f47a90a7e2b41)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/f58c20f2790bdbbb20cc43b70d1517454d9ef86c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Krzysztof-Wilczy-ski/PCI-sysfs-Move-to-kstrtobool-to-handle-user-input/20210706-052334
git checkout f58c20f2790bdbbb20cc43b70d1517454d9ef86c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/pci/iov.c:389:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (num_vfs == pdev->sriov->num_VFs)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/iov.c:431:6: note: uninitialized use occurs here
if (ret < 0)
^~~
drivers/pci/iov.c:389:2: note: remove the 'if' if its condition is always false
if (num_vfs == pdev->sriov->num_VFs)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/iov.c:378:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
vim +389 drivers/pci/iov.c
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 365
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 366 /*
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 367 * num_vfs > 0; number of VFs to enable
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 368 * num_vfs = 0; disable all VFs
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 369 *
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 370 * Note: SRIOV spec does not allow partial VF
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 371 * disable, so it's all or none.
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 372 */
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 373 static ssize_t sriov_numvfs_store(struct device *dev,
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 374 struct device_attribute *attr,
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 375 const char *buf, size_t count)
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 376 {
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 377 struct pci_dev *pdev = to_pci_dev(dev);
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 378 int ret;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 379 u16 num_vfs;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 380
f58c20f2790bdb Krzysztof Wilczyński 2021-07-05 381 if (kstrtou16(buf, 0, &num_vfs) < 0)
f58c20f2790bdb Krzysztof Wilczyński 2021-07-05 382 return -EINVAL;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 383
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 384 if (num_vfs > pci_sriov_get_totalvfs(pdev))
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 385 return -ERANGE;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 386
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 387 device_lock(&pdev->dev);
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 388
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 @389 if (num_vfs == pdev->sriov->num_VFs)
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 390 goto exit;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 391
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 392 /* is PF driver loaded */
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 393 if (!pdev->driver) {
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 394 pci_info(pdev, "no driver bound to device; cannot configure SR-IOV\n");
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 395 ret = -ENOENT;
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 396 goto exit;
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 397 }
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 398
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 399 /* is PF driver loaded w/callback */
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 400 if (!pdev->driver->sriov_configure) {
e9c3bbd68ec7dc Moritz Fischer 2021-03-27 401 pci_info(pdev, "driver does not support SR-IOV configuration via sysfs\n");
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 402 ret = -ENOENT;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 403 goto exit;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 404 }
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 405
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 406 if (num_vfs == 0) {
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 407 /* disable VFs */
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 408 ret = pdev->driver->sriov_configure(pdev, 0);
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 409 goto exit;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 410 }
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 411
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 412 /* enable VFs */
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 413 if (pdev->sriov->num_VFs) {
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 414 pci_warn(pdev, "%d VFs already enabled. Disable before enabling %d VFs\n",
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 415 pdev->sriov->num_VFs, num_vfs);
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 416 ret = -EBUSY;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 417 goto exit;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 418 }
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 419
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 420 ret = pdev->driver->sriov_configure(pdev, num_vfs);
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 421 if (ret < 0)
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 422 goto exit;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 423
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 424 if (ret != num_vfs)
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 425 pci_warn(pdev, "%d VFs requested; only %d enabled\n",
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 426 num_vfs, ret);
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 427
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 428 exit:
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 429 device_unlock(&pdev->dev);
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 430
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 431 if (ret < 0)
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 432 return ret;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 433
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 434 return count;
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 435 }
aaee0c1ffd6399 Kelsey Skunberg 2019-08-13 436
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45764 bytes --]
next prev parent reply other threads:[~2021-07-06 0:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 21:23 [PATCH 1/4] PCI/sysfs: Move to kstrtobool() to handle user input Krzysztof Wilczyński
2021-07-05 21:23 ` [PATCH 2/4] PCI/sysfs: Check CAP_SYS_ADMIN before parsing " Krzysztof Wilczyński
2021-09-14 20:40 ` Bjorn Helgaas
2021-09-15 1:15 ` Krzysztof Wilczyński
2021-07-05 21:23 ` [PATCH 3/4] PCI/sysfs: Return -EINVAL consistently from "store" functions Krzysztof Wilczyński
2021-07-06 0:24 ` kernel test robot [this message]
2021-07-06 0:35 ` Krzysztof Wilczyński
2021-07-05 21:23 ` [PATCH 4/4] PCI: Don't use the strtobool() wrapper for kstrtobool() Krzysztof Wilczyński
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=202107060836.P5flQNoN-lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=helgaas@kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=kishon@ti.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.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