From: Michal Kubecek <mkubecek@suse.cz>
To: netdev@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net] ethtool: linkinfo: remove an unnecessary NULL check
Date: Fri, 5 Jun 2020 14:31:54 +0200 [thread overview]
Message-ID: <20200605123154.vwhlbnqthvtciauj@lion.mk-sys.cz> (raw)
In-Reply-To: <20200605110413.GF978434@mwanda>
[-- Attachment #1: Type: text/plain, Size: 1212 bytes --]
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@oracle.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-06-05 12:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-05 11:04 [PATCH net] ethtool: linkinfo: remove an unnecessary NULL check Dan Carpenter
2020-06-05 12:31 ` Michal Kubecek [this message]
2020-06-05 20:11 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200605123154.vwhlbnqthvtciauj@lion.mk-sys.cz \
--to=mkubecek@suse.cz \
--cc=andrew@lunn.ch \
--cc=dan.carpenter@oracle.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).