All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/isdn/hardware/mISDN/hfcsusb.c:1695:16: warning: use of uninitialized value '<unknown>' [CWE-457]
@ 2022-09-03 13:54 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-09-03 13:54 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6737 bytes --]

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check first_new_problem: drivers/isdn/hardware/mISDN/hfcsusb.c:1695:16: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]"
:::::: 

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Kees Cook <keescook@chromium.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d895ec7938c431fe61a731939da76a6461bc6133
commit: f68f2ff91512c199ec24883001245912afc17873 fortify: Detect struct member overflows in memcpy() at compile-time
date:   7 months ago
:::::: branch date: 14 hours ago
:::::: commit date: 7 months ago
config: arm-randconfig-c002-20220830 (https://download.01.org/0day-ci/archive/20220903/202209032118.HAAV9IXB-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.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
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f68f2ff91512c199ec24883001245912afc17873
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout f68f2ff91512c199ec24883001245912afc17873
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

gcc_analyzer warnings: (new ones prefixed by >>)
   drivers/isdn/hardware/mISDN/hfcsusb.c: In function 'setup_hfcsusb':
>> drivers/isdn/hardware/mISDN/hfcsusb.c:1695:16: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
    1695 |         u_char b;
         |                ^
     'setup_hfcsusb': event 1
       |
       | 1695 |         u_char b;
       |      |                ^
       |      |                |
       |      |                (1) use of uninitialized value '<unknown>' here
       |

vim +1695 drivers/isdn/hardware/mISDN/hfcsusb.c

69f52adb2d534a Karsten Keil        2009-01-09  1688  
69f52adb2d534a Karsten Keil        2009-01-09  1689  
69f52adb2d534a Karsten Keil        2009-01-09  1690  /* Hardware Initialization */
6c2959aa7b81b8 Hannes Eder         2009-02-12  1691  static int
69f52adb2d534a Karsten Keil        2009-01-09  1692  setup_hfcsusb(struct hfcsusb *hw)
69f52adb2d534a Karsten Keil        2009-01-09  1693  {
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1694  	void *dmabuf = kmalloc(sizeof(u_char), GFP_KERNEL);
69f52adb2d534a Karsten Keil        2009-01-09 @1695  	u_char b;
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1696  	int ret;
69f52adb2d534a Karsten Keil        2009-01-09  1697  
69f52adb2d534a Karsten Keil        2009-01-09  1698  	if (debug & DBG_HFC_CALL_TRACE)
69f52adb2d534a Karsten Keil        2009-01-09  1699  		printk(KERN_DEBUG "%s: %s\n", hw->name, __func__);
69f52adb2d534a Karsten Keil        2009-01-09  1700  
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1701  	if (!dmabuf)
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1702  		return -ENOMEM;
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1703  
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1704  	ret = read_reg_atomic(hw, HFCUSB_CHIP_ID, dmabuf);
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1705  
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1706  	memcpy(&b, dmabuf, sizeof(u_char));
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1707  	kfree(dmabuf);
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1708  
69f52adb2d534a Karsten Keil        2009-01-09  1709  	/* check the chip id */
d8a1de3d5bb881 Juliana Rodrigueiro 2019-07-31  1710  	if (ret != 1) {
69f52adb2d534a Karsten Keil        2009-01-09  1711  		printk(KERN_DEBUG "%s: %s: cannot read chip id\n",
69f52adb2d534a Karsten Keil        2009-01-09  1712  		       hw->name, __func__);
69f52adb2d534a Karsten Keil        2009-01-09  1713  		return 1;
69f52adb2d534a Karsten Keil        2009-01-09  1714  	}
69f52adb2d534a Karsten Keil        2009-01-09  1715  	if (b != HFCUSB_CHIPID) {
69f52adb2d534a Karsten Keil        2009-01-09  1716  		printk(KERN_DEBUG "%s: %s: Invalid chip id 0x%02x\n",
69f52adb2d534a Karsten Keil        2009-01-09  1717  		       hw->name, __func__, b);
69f52adb2d534a Karsten Keil        2009-01-09  1718  		return 1;
69f52adb2d534a Karsten Keil        2009-01-09  1719  	}
69f52adb2d534a Karsten Keil        2009-01-09  1720  
69f52adb2d534a Karsten Keil        2009-01-09  1721  	/* first set the needed config, interface and alternate */
3c76c58fca03c1 David S. Miller     2011-04-17  1722  	(void) usb_set_interface(hw->dev, hw->if_used, hw->alt_used);
69f52adb2d534a Karsten Keil        2009-01-09  1723  
69f52adb2d534a Karsten Keil        2009-01-09  1724  	hw->led_state = 0;
69f52adb2d534a Karsten Keil        2009-01-09  1725  
69f52adb2d534a Karsten Keil        2009-01-09  1726  	/* init the background machinery for control requests */
69f52adb2d534a Karsten Keil        2009-01-09  1727  	hw->ctrl_read.bRequestType = 0xc0;
69f52adb2d534a Karsten Keil        2009-01-09  1728  	hw->ctrl_read.bRequest = 1;
69f52adb2d534a Karsten Keil        2009-01-09  1729  	hw->ctrl_read.wLength = cpu_to_le16(1);
69f52adb2d534a Karsten Keil        2009-01-09  1730  	hw->ctrl_write.bRequestType = 0x40;
69f52adb2d534a Karsten Keil        2009-01-09  1731  	hw->ctrl_write.bRequest = 0;
69f52adb2d534a Karsten Keil        2009-01-09  1732  	hw->ctrl_write.wLength = 0;
69f52adb2d534a Karsten Keil        2009-01-09  1733  	usb_fill_control_urb(hw->ctrl_urb, hw->dev, hw->ctrl_out_pipe,
69f52adb2d534a Karsten Keil        2009-01-09  1734  			     (u_char *)&hw->ctrl_write, NULL, 0,
69f52adb2d534a Karsten Keil        2009-01-09  1735  			     (usb_complete_t)ctrl_complete, hw);
69f52adb2d534a Karsten Keil        2009-01-09  1736  
69f52adb2d534a Karsten Keil        2009-01-09  1737  	reset_hfcsusb(hw);
69f52adb2d534a Karsten Keil        2009-01-09  1738  	return 0;
69f52adb2d534a Karsten Keil        2009-01-09  1739  }
69f52adb2d534a Karsten Keil        2009-01-09  1740  

:::::: The code at line 1695 was first introduced by commit
:::::: 69f52adb2d534afc41fcc658f155e01f0b322f9e mISDN: Add HFC USB driver

:::::: TO: Karsten Keil <kkeil@suse.de>
:::::: CC: Karsten Keil <kkeil@suse.de>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-03 13:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-03 13:54 drivers/isdn/hardware/mISDN/hfcsusb.c:1695:16: warning: use of uninitialized value '<unknown>' [CWE-457] kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.