tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git queue-4.4
head: 517550f651234b0e27057d8108908f58f07fa357
commit: 5f936529eee86906de3b0dba0d40ddc29bb8bac1 [84/103] cxl: Fix kobject memleak
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.5.0
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
git checkout 5f936529eee86906de3b0dba0d40ddc29bb8bac1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from arch/powerpc/include/asm/bug.h:127:0,
from arch/powerpc/include/asm/mmu-hash64.h:17,
from arch/powerpc/include/asm/mmu.h:185,
from arch/powerpc/include/asm/lppaca.h:36,
from arch/powerpc/include/asm/paca.h:20,
from arch/powerpc/include/asm/current.h:16,
from include/linux/mutex.h:13,
from include/linux/kernfs.h:13,
from include/linux/sysfs.h:15,
from include/linux/kobject.h:21,
from include/linux/device.h:17,
from drivers/misc/cxl/sysfs.c:11:
include/linux/cpumask.h: In function 'cpumask_check':
include/linux/cpumask.h:117:19: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
WARN_ON_ONCE(cpu >= nr_cpumask_bits);
^
include/asm-generic/bug.h:112:27: note: in definition of macro 'WARN_ON_ONCE'
int __ret_warn_once = !!(condition); \
^~~~~~~~~
drivers/misc/cxl/sysfs.c: In function 'prefault_mode_store':
drivers/misc/cxl/sysfs.c:306:11: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
if (mode == -1)
^~
drivers/misc/cxl/sysfs.c: In function 'cxl_sysfs_adapter_add':
drivers/misc/cxl/sysfs.c:411:16: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
for (i = 0; i < ARRAY_SIZE(adapter_attrs); i++) {
^
drivers/misc/cxl/sysfs.c: In function 'cxl_sysfs_adapter_remove':
drivers/misc/cxl/sysfs.c:425:16: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
for (i = 0; i < ARRAY_SIZE(adapter_attrs); i++)
^
drivers/misc/cxl/sysfs.c: In function 'cxl_sysfs_afu_new_cr':
> drivers/misc/cxl/sysfs.c:558:1: error: label 'err'
defined but not used [-Werror=unused-label]
err:
^~~
drivers/misc/cxl/sysfs.c: In function 'cxl_sysfs_afu_remove':
drivers/misc/cxl/sysfs.c:572:16: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
for (i = 0; i < ARRAY_SIZE(afu_attrs); i++)
^
drivers/misc/cxl/sysfs.c: In function 'cxl_sysfs_afu_add':
drivers/misc/cxl/sysfs.c:588:16: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
for (i = 0; i < ARRAY_SIZE(afu_attrs); i++) {
^
drivers/misc/cxl/sysfs.c: In function 'cxl_sysfs_afu_m_add':
drivers/misc/cxl/sysfs.c:638:16: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
for (i = 0; i < ARRAY_SIZE(afu_master_attrs); i++) {
^
drivers/misc/cxl/sysfs.c: In function 'cxl_sysfs_afu_m_remove':
drivers/misc/cxl/sysfs.c:655:16: error: comparison between signed and unsigned integer
expressions [-Werror=sign-compare]
for (i = 0; i < ARRAY_SIZE(afu_master_attrs); i++)
^
cc1: all warnings being treated as errors
#
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/c...
git remote add sashal-linux-stable
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
git fetch --no-tags sashal-linux-stable queue-4.4
git checkout 5f936529eee86906de3b0dba0d40ddc29bb8bac1
vim +/err +558 drivers/misc/cxl/sysfs.c
b087e6190ddcd9 Ian Munsie 2015-02-04 509
b087e6190ddcd9 Ian Munsie 2015-02-04 510 static struct afu_config_record
*cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int cr_idx)
b087e6190ddcd9 Ian Munsie 2015-02-04 511 {
b087e6190ddcd9 Ian Munsie 2015-02-04 512 struct afu_config_record *cr;
b087e6190ddcd9 Ian Munsie 2015-02-04 513 int rc;
b087e6190ddcd9 Ian Munsie 2015-02-04 514
b087e6190ddcd9 Ian Munsie 2015-02-04 515 cr = kzalloc(sizeof(struct afu_config_record),
GFP_KERNEL);
b087e6190ddcd9 Ian Munsie 2015-02-04 516 if (!cr)
b087e6190ddcd9 Ian Munsie 2015-02-04 517 return ERR_PTR(-ENOMEM);
b087e6190ddcd9 Ian Munsie 2015-02-04 518
b087e6190ddcd9 Ian Munsie 2015-02-04 519 cr->cr = cr_idx;
b087e6190ddcd9 Ian Munsie 2015-02-04 520 cr->device = cxl_afu_cr_read16(afu, cr_idx,
PCI_DEVICE_ID);
b087e6190ddcd9 Ian Munsie 2015-02-04 521 cr->vendor = cxl_afu_cr_read16(afu, cr_idx,
PCI_VENDOR_ID);
b087e6190ddcd9 Ian Munsie 2015-02-04 522 cr->class = cxl_afu_cr_read32(afu, cr_idx,
PCI_CLASS_REVISION) >> 8;
b087e6190ddcd9 Ian Munsie 2015-02-04 523
b087e6190ddcd9 Ian Munsie 2015-02-04 524 /*
b087e6190ddcd9 Ian Munsie 2015-02-04 525 * Export raw AFU PCIe like config record. For
now this is read only by
b087e6190ddcd9 Ian Munsie 2015-02-04 526 * root - we can expand that later to be
readable by non-root and maybe
b087e6190ddcd9 Ian Munsie 2015-02-04 527 * even writable provided we have a good
use-case. Once we suport
b087e6190ddcd9 Ian Munsie 2015-02-04 528 * exposing AFUs through a virtual PHB they
will get that for free from
b087e6190ddcd9 Ian Munsie 2015-02-04 529 * Linux' PCI infrastructure, but until
then it's not clear that we
b087e6190ddcd9 Ian Munsie 2015-02-04 530 * need it for anything since the main use
case is just identifying
b087e6190ddcd9 Ian Munsie 2015-02-04 531 * AFUs, which can be done via the vendor,
device and class attributes.
b087e6190ddcd9 Ian Munsie 2015-02-04 532 */
b087e6190ddcd9 Ian Munsie 2015-02-04 533 sysfs_bin_attr_init(&cr->config_attr);
b087e6190ddcd9 Ian Munsie 2015-02-04 534 cr->config_attr.attr.name =
"config";
b087e6190ddcd9 Ian Munsie 2015-02-04 535 cr->config_attr.attr.mode = S_IRUSR;
b087e6190ddcd9 Ian Munsie 2015-02-04 536 cr->config_attr.size = afu->crs_len;
b087e6190ddcd9 Ian Munsie 2015-02-04 537 cr->config_attr.read = afu_read_config;
b087e6190ddcd9 Ian Munsie 2015-02-04 538
b087e6190ddcd9 Ian Munsie 2015-02-04 539 rc = kobject_init_and_add(&cr->kobj,
&afu_config_record_type,
b087e6190ddcd9 Ian Munsie 2015-02-04 540 &afu->dev.kobj, "cr%i",
cr->cr);
b087e6190ddcd9 Ian Munsie 2015-02-04 541 if (rc)
5f936529eee869 Wang Hai 2020-06-02 542 goto err1;
b087e6190ddcd9 Ian Munsie 2015-02-04 543
b087e6190ddcd9 Ian Munsie 2015-02-04 544 rc = sysfs_create_bin_file(&cr->kobj,
&cr->config_attr);
b087e6190ddcd9 Ian Munsie 2015-02-04 545 if (rc)
b087e6190ddcd9 Ian Munsie 2015-02-04 546 goto err1;
b087e6190ddcd9 Ian Munsie 2015-02-04 547
b087e6190ddcd9 Ian Munsie 2015-02-04 548 rc = kobject_uevent(&cr->kobj,
KOBJ_ADD);
b087e6190ddcd9 Ian Munsie 2015-02-04 549 if (rc)
b087e6190ddcd9 Ian Munsie 2015-02-04 550 goto err2;
b087e6190ddcd9 Ian Munsie 2015-02-04 551
b087e6190ddcd9 Ian Munsie 2015-02-04 552 return cr;
b087e6190ddcd9 Ian Munsie 2015-02-04 553 err2:
b087e6190ddcd9 Ian Munsie 2015-02-04 554 sysfs_remove_bin_file(&cr->kobj,
&cr->config_attr);
b087e6190ddcd9 Ian Munsie 2015-02-04 555 err1:
b087e6190ddcd9 Ian Munsie 2015-02-04 556 kobject_put(&cr->kobj);
b087e6190ddcd9 Ian Munsie 2015-02-04 557 return ERR_PTR(rc);
f204e0b8cedd7d Ian Munsie 2014-10-08 @558 err:
b087e6190ddcd9 Ian Munsie 2015-02-04 559 kfree(cr);
b087e6190ddcd9 Ian Munsie 2015-02-04 560 return ERR_PTR(rc);
f204e0b8cedd7d Ian Munsie 2014-10-08 561 }
f204e0b8cedd7d Ian Munsie 2014-10-08 562
:::::: The code at line 558 was first introduced by commit
:::::: f204e0b8cedd7da1dfcfd05ed6b7692737e24029 cxl: Driver code for powernv PCIe based
cards for userspace access
:::::: TO: Ian Munsie <imunsie(a)au1.ibm.com>
:::::: CC: Michael Ellerman <mpe(a)ellerman.id.au>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org