lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202205030045.IFzrRoky-lkp@intel.com>
Date:   Tue, 3 May 2022 00:11:22 +0800
From:   kernel test robot <lkp@...el.com>
To:     John Efstathiades <john.efstathiades@...blebay.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/net/usb/lan78xx.c:4573:8: warning: Local variable 'ret'
 shadows outer variable [shadowVariable]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   672c0c5173427e6b3e2a9bbb7be51ceeec78093a
commit: 5f4cc6e25148cc141f97afb41b4dfe9eb1cce613 lan78xx: Fix race conditions in suspend/resume handling
date:   8 months ago
compiler: arc-elf-gcc (GCC) 11.3.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 5f4cc6e25148cc141f97afb41b4dfe9eb1cce613
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


cppcheck warnings: (new ones prefixed by >>)
        ^
   drivers/net/usb/lan78xx.c:1873:6: note: ret is overwritten
    ret = lan78xx_write_reg(dev, MII_ACC, addr);
        ^
   drivers/net/usb/lan78xx.c:1131:7: warning: Local variable 'i' shadows outer variable [shadowVariable]
     int i;
         ^
   drivers/net/usb/lan78xx.c:1100:6: note: Shadowed declaration
    int i;
        ^
   drivers/net/usb/lan78xx.c:1131:7: note: Shadow variable
     int i;
         ^
>> drivers/net/usb/lan78xx.c:4573:8: warning: Local variable 'ret' shadows outer variable [shadowVariable]
      int ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);
          ^
   drivers/net/usb/lan78xx.c:4557:6: note: Shadowed declaration
    int ret;
        ^
   drivers/net/usb/lan78xx.c:4573:8: note: Shadow variable
      int ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);
          ^

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

        ^
   drivers/net/usb/lan78xx.c:1873:6: note: ret is overwritten
    ret = lan78xx_write_reg(dev, MII_ACC, addr);
        ^
>> drivers/net/usb/lan78xx.c:1048:23: warning: Parameter 'addr' can be declared with const [constParameter]
           int index, u8 addr[ETH_ALEN])
                         ^
>> drivers/net/usb/lan78xx.c:793:25: warning: Parameter 'data' can be declared with const [constParameter]
           u32 length, u8 *data)
                           ^

vim +/ret +4573 drivers/net/usb/lan78xx.c

  4552	
  4553	static int lan78xx_resume(struct usb_interface *intf)
  4554	{
  4555		struct lan78xx_net *dev = usb_get_intfdata(intf);
  4556		bool dev_open;
  4557		int ret;
  4558	
  4559		mutex_lock(&dev->dev_mutex);
  4560	
  4561		netif_dbg(dev, ifup, dev->net, "resuming device");
  4562	
  4563		dev_open = test_bit(EVENT_DEV_OPEN, &dev->flags);
  4564	
  4565		if (dev_open) {
  4566			bool pipe_halted = false;
  4567	
  4568			ret = lan78xx_flush_tx_fifo(dev);
  4569			if (ret < 0)
  4570				goto out;
  4571	
  4572			if (dev->urb_intr) {
> 4573				int ret = usb_submit_urb(dev->urb_intr, GFP_KERNEL);
  4574	
  4575				if (ret < 0) {
  4576					if (ret == -ENODEV)
  4577						netif_device_detach(dev->net);
  4578	
  4579				netdev_warn(dev->net, "Failed to submit intr URB");
  4580				}
  4581			}
  4582	
  4583			spin_lock_irq(&dev->txq.lock);
  4584	
  4585			if (netif_device_present(dev->net)) {
  4586				pipe_halted = lan78xx_submit_deferred_urbs(dev);
  4587	
  4588				if (pipe_halted)
  4589					lan78xx_defer_kevent(dev, EVENT_TX_HALT);
  4590			}
  4591	
  4592			clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
  4593	
  4594			spin_unlock_irq(&dev->txq.lock);
  4595	
  4596			if (!pipe_halted &&
  4597			    netif_device_present(dev->net) &&
  4598			    (skb_queue_len(&dev->txq) < dev->tx_qlen))
  4599				netif_start_queue(dev->net);
  4600	
  4601			ret = lan78xx_start_tx_path(dev);
  4602			if (ret < 0)
  4603				goto out;
  4604	
  4605			tasklet_schedule(&dev->bh);
  4606	
  4607			if (!timer_pending(&dev->stat_monitor)) {
  4608				dev->delta = 1;
  4609				mod_timer(&dev->stat_monitor,
  4610					  jiffies + STAT_UPDATE_TIMER);
  4611			}
  4612	
  4613		} else {
  4614			clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
  4615		}
  4616	
  4617		ret = lan78xx_write_reg(dev, WUCSR2, 0);
  4618		if (ret < 0)
  4619			goto out;
  4620		ret = lan78xx_write_reg(dev, WUCSR, 0);
  4621		if (ret < 0)
  4622			goto out;
  4623		ret = lan78xx_write_reg(dev, WK_SRC, 0xFFF1FF1FUL);
  4624		if (ret < 0)
  4625			goto out;
  4626	
  4627		ret = lan78xx_write_reg(dev, WUCSR2, WUCSR2_NS_RCD_ |
  4628						     WUCSR2_ARP_RCD_ |
  4629						     WUCSR2_IPV6_TCPSYN_RCD_ |
  4630						     WUCSR2_IPV4_TCPSYN_RCD_);
  4631		if (ret < 0)
  4632			goto out;
  4633	
  4634		ret = lan78xx_write_reg(dev, WUCSR, WUCSR_EEE_TX_WAKE_ |
  4635						    WUCSR_EEE_RX_WAKE_ |
  4636						    WUCSR_PFDA_FR_ |
  4637						    WUCSR_RFE_WAKE_FR_ |
  4638						    WUCSR_WUFR_ |
  4639						    WUCSR_MPR_ |
  4640						    WUCSR_BCST_FR_);
  4641		if (ret < 0)
  4642			goto out;
  4643	
  4644		ret = 0;
  4645	out:
  4646		mutex_unlock(&dev->dev_mutex);
  4647	
  4648		return ret;
  4649	}
  4650	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ