tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 2f73937c9aa561e2082839bc1a8efaac75d6e244 commit: 61a6199787d97660d99aa3399c9165c0cf752211 [4244/5318] PCI: Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure config: ia64-randconfig-m031-20210804 (attached as .config) compiler: ia64-linux-gcc (GCC) 10.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> smatch warnings: drivers/pci/syscall.c:82 __do_sys_pciconfig_read() error: uninitialized symbol 'dev'. drivers/pci/syscall.c:82 __do_sys_pciconfig_read() error: uninitialized symbol 'dev'. vim +/dev +82 drivers/pci/syscall.c c4ea37c26a691a Heiko Carstens 2009-01-14 15 SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, c4ea37c26a691a Heiko Carstens 2009-01-14 16 unsigned long, off, unsigned long, len, void __user *, buf) ^1da177e4c3f41 Linus Torvalds 2005-04-16 17 { ^1da177e4c3f41 Linus Torvalds 2005-04-16 18 struct pci_dev *dev; ^^^^^^^^^^^^^^^^^^^^ ^1da177e4c3f41 Linus Torvalds 2005-04-16 19 u8 byte; ^1da177e4c3f41 Linus Torvalds 2005-04-16 20 u16 word; ^1da177e4c3f41 Linus Torvalds 2005-04-16 21 u32 dword; e4585da22ad04a Alan Cox 2007-04-23 22 long err; ef9e4005cbaf02 Heiner Kallweit 2021-01-24 23 int cfg_ret; ^1da177e4c3f41 Linus Torvalds 2005-04-16 24 61a6199787d976 Krzysztof Wilczyński 2021-07-29 25 err = -EPERM; ^1da177e4c3f41 Linus Torvalds 2005-04-16 26 if (!capable(CAP_SYS_ADMIN)) 61a6199787d976 Krzysztof Wilczyński 2021-07-29 27 goto error; ^^^^^^^^^^ ^1da177e4c3f41 Linus Torvalds 2005-04-16 28 ^1da177e4c3f41 Linus Torvalds 2005-04-16 29 err = -ENODEV; 39c9465204e8f4 Sinan Kaya 2017-12-19 30 dev = pci_get_domain_bus_and_slot(0, bus, dfn); ^1da177e4c3f41 Linus Torvalds 2005-04-16 31 if (!dev) ^1da177e4c3f41 Linus Torvalds 2005-04-16 32 goto error; ^1da177e4c3f41 Linus Torvalds 2005-04-16 33 ^1da177e4c3f41 Linus Torvalds 2005-04-16 34 switch (len) { ^1da177e4c3f41 Linus Torvalds 2005-04-16 35 case 1: e04b0ea2e0f9c1 Brian King 2005-09-27 36 cfg_ret = pci_user_read_config_byte(dev, off, &byte); ^1da177e4c3f41 Linus Torvalds 2005-04-16 37 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 38 case 2: e04b0ea2e0f9c1 Brian King 2005-09-27 39 cfg_ret = pci_user_read_config_word(dev, off, &word); ^1da177e4c3f41 Linus Torvalds 2005-04-16 40 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 41 case 4: e04b0ea2e0f9c1 Brian King 2005-09-27 42 cfg_ret = pci_user_read_config_dword(dev, off, &dword); ^1da177e4c3f41 Linus Torvalds 2005-04-16 43 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 44 default: ^1da177e4c3f41 Linus Torvalds 2005-04-16 45 err = -EINVAL; ^1da177e4c3f41 Linus Torvalds 2005-04-16 46 goto error; f7625980f5820e Bjorn Helgaas 2013-11-14 47 } ^1da177e4c3f41 Linus Torvalds 2005-04-16 48 ^1da177e4c3f41 Linus Torvalds 2005-04-16 49 err = -EIO; ef9e4005cbaf02 Heiner Kallweit 2021-01-24 50 if (cfg_ret) ^1da177e4c3f41 Linus Torvalds 2005-04-16 51 goto error; ^1da177e4c3f41 Linus Torvalds 2005-04-16 52 ^1da177e4c3f41 Linus Torvalds 2005-04-16 53 switch (len) { ^1da177e4c3f41 Linus Torvalds 2005-04-16 54 case 1: ^1da177e4c3f41 Linus Torvalds 2005-04-16 55 err = put_user(byte, (unsigned char __user *)buf); ^1da177e4c3f41 Linus Torvalds 2005-04-16 56 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 57 case 2: ^1da177e4c3f41 Linus Torvalds 2005-04-16 58 err = put_user(word, (unsigned short __user *)buf); ^1da177e4c3f41 Linus Torvalds 2005-04-16 59 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 60 case 4: ^1da177e4c3f41 Linus Torvalds 2005-04-16 61 err = put_user(dword, (unsigned int __user *)buf); ^1da177e4c3f41 Linus Torvalds 2005-04-16 62 break; e4585da22ad04a Alan Cox 2007-04-23 63 } e4585da22ad04a Alan Cox 2007-04-23 64 pci_dev_put(dev); ^1da177e4c3f41 Linus Torvalds 2005-04-16 65 return err; ^1da177e4c3f41 Linus Torvalds 2005-04-16 66 ^1da177e4c3f41 Linus Torvalds 2005-04-16 67 error: ^1da177e4c3f41 Linus Torvalds 2005-04-16 68 /* ??? XFree86 doesn't even check the return value. They ^1da177e4c3f41 Linus Torvalds 2005-04-16 69 just look for 0xffffffff in the output, since that's what ^1da177e4c3f41 Linus Torvalds 2005-04-16 70 they get instead of a machine check on x86. */ ^1da177e4c3f41 Linus Torvalds 2005-04-16 71 switch (len) { ^1da177e4c3f41 Linus Torvalds 2005-04-16 72 case 1: ^1da177e4c3f41 Linus Torvalds 2005-04-16 73 put_user(-1, (unsigned char __user *)buf); ^1da177e4c3f41 Linus Torvalds 2005-04-16 74 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 75 case 2: ^1da177e4c3f41 Linus Torvalds 2005-04-16 76 put_user(-1, (unsigned short __user *)buf); ^1da177e4c3f41 Linus Torvalds 2005-04-16 77 break; ^1da177e4c3f41 Linus Torvalds 2005-04-16 78 case 4: ^1da177e4c3f41 Linus Torvalds 2005-04-16 79 put_user(-1, (unsigned int __user *)buf); ^1da177e4c3f41 Linus Torvalds 2005-04-16 80 break; e4585da22ad04a Alan Cox 2007-04-23 81 } e4585da22ad04a Alan Cox 2007-04-23 @82 pci_dev_put(dev); ^^^ Uninitialized. ^1da177e4c3f41 Linus Torvalds 2005-04-16 83 return err; ^1da177e4c3f41 Linus Torvalds 2005-04-16 84 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx