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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94550f41-1204-8996-ef32-c25429481ceb@gmail.com>
Date:   Mon, 9 Aug 2021 14:06:11 +0300
From:   Pavel Skripkin <paskripkin@...il.com>
To:     kernel test robot <rong.a.chen@...el.com>,
        Petko Manolov <petkan@...leusys.com>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: Re: drivers/net/usb/pegasus.c:461:2: warning: Value stored to 'ret'
 is never read [clang-analyzer-deadcode.DeadStores]

On 8/9/21 1:37 PM, kernel test robot wrote:
> 
> tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   85a90500f9a1717c4e142ce92e6c1cb1a339ec78
> commit: 8a160e2e9aeb8318159b48701ad8a6e22274372d net: usb: pegasus:
> Check the return value of get_geristers() and friends;
> date:   4 days ago
> :::::: branch date: 8 hours ago
> :::::: commit date: 4 days ago
> config: x86_64-randconfig-c001-20210808 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project
> 41a6b50c25961addc04438b567ee1f4ef9e40f98)
> 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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8a160e2e9aeb8318159b48701ad8a6e22274372d
>           git remote add linus
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>           git fetch --no-tags linus master
>           git checkout 8a160e2e9aeb8318159b48701ad8a6e22274372d
>           # save the attached .config to linux build tree
>           COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross
> ARCH=x86_64 clang-analyzer
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>

Hi, @Petko!

For you not to scan all these warnings:

>>> drivers/net/usb/pegasus.c:461:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
>              ret = set_registers(pegasus, EthCtrl0, 3, data);
>              ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      drivers/net/usb/pegasus.c:461:2: note: Value stored to 'ret' is
> never read
>              ret = set_registers(pegasus, EthCtrl0, 3, data);
>              ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is the real bug, I think. Can be fixed like this:

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 22353bab76c8..f2b8891c7b36 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -459,6 +459,8 @@ static int enable_net_traffic(struct net_device 
*dev, struct usb_device *usb)

  	memcpy(pegasus->eth_regs, data, sizeof(data));
  	ret = set_registers(pegasus, EthCtrl0, 3, data);
+	if (ret < 0)
+		goto fail;

  	if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
  	    usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 ||


It was caused by our last refactoring: enable_net_traffic() now returns 
0 on success and this ret is never checked.


With regards,
Pavel Skripkin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ