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] [day] [month] [year] [list]
Date:   Sat, 6 Jun 2020 15:48:38 +0200
From:   Michal Kubecek <mkubecek@...e.cz>
To:     Vasily Averin <vvs@...tuozzo.com>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH] ethtool: remove extra checks

On Sat, Jun 06, 2020 at 03:49:05PM +0300, Vasily Averin wrote:
> Found by smatch:
> net/ethtool/linkmodes.c:356 ethnl_set_linkmodes() warn:
>  variable dereferenced before check 'info' (see line 332)
> net/ethtool/linkinfo.c:143 ethnl_set_linkinfo() warn:
>  variable dereferenced before check 'info' (see line 119
> 
> In both cases non-zero 'info' is always provided by caller.
> 
> Signed-off-by: Vasily Averin <vvs@...tuozzo.com>
> ---
>  net/ethtool/linkinfo.c  | 3 +--
>  net/ethtool/linkmodes.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/net/ethtool/linkinfo.c b/net/ethtool/linkinfo.c
> index 677068d..5eaf173 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;

This change is already in net tree as commit 178f67b1288b ("ethtool:
linkinfo: remove an unnecessary NULL check").

> diff --git a/net/ethtool/linkmodes.c b/net/ethtool/linkmodes.c
> index 452608c..b759133 100644
> --- a/net/ethtool/linkmodes.c
> +++ b/net/ethtool/linkmodes.c
> @@ -353,8 +353,7 @@ int ethnl_set_linkmodes(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;
>  	}
>  

For this part, 

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

Michal

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