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: <20200605123154.vwhlbnqthvtciauj@lion.mk-sys.cz>
Date:   Fri, 5 Jun 2020 14:31:54 +0200
From:   Michal Kubecek <mkubecek@...e.cz>
To:     netdev@...r.kernel.org
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] ethtool: linkinfo: remove an unnecessary NULL check

On Fri, Jun 05, 2020 at 02:04:13PM +0300, Dan Carpenter wrote:
> This code generates a Smatch warning:
> 
>     net/ethtool/linkinfo.c:143 ethnl_set_linkinfo()
>     warn: variable dereferenced before check 'info' (see line 119)
> 
> Fortunately, the "info" pointer is never NULL so the check can be
> removed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

Reviewed-by: Michal Kubecek <mkubecek@...e.cz>

The same useless check is also in ethnl_set_linkmodes(), I'll send
a patch for that one.

Michal

> ---
>  net/ethtool/linkinfo.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/ethtool/linkinfo.c b/net/ethtool/linkinfo.c
> index 677068deb68c0..5eaf173eaaca5 100644
> --- a/net/ethtool/linkinfo.c
> +++ b/net/ethtool/linkinfo.c
> @@ -140,8 +140,7 @@ int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info)
>  
>  	ret = __ethtool_get_link_ksettings(dev, &ksettings);
>  	if (ret < 0) {
> -		if (info)
> -			GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
> +		GENL_SET_ERR_MSG(info, "failed to retrieve link settings");
>  		goto out_ops;
>  	}
>  	lsettings = &ksettings.base;
> -- 
> 2.26.2
> 

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ