From: Michal Kubecek <mkubecek@suse.cz>
To: Gaurav Singh <gaurav1086@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Oleksij Rempel <linux@rempel-privat.de>,
YueHaibing <yuehaibing@huawei.com>, Aya Levin <ayal@mellanox.com>,
"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [net/ethtool] ethnl_set_linkmodes: remove redundant null check
Date: Fri, 31 Jul 2020 15:54:56 +0200 [thread overview]
Message-ID: <20200731135456.gbzznq6x2f5pznx6@carpenter.suse.cz> (raw)
In-Reply-To: <20200731045908.32466-1-gaurav1086@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]
On Fri, Jul 31, 2020 at 12:58:44AM -0400, Gaurav Singh wrote:
> info cannot be NULL here since its being accessed earlier
> in the function: nlmsg_parse(info->nlhdr...). Remove this
> redundant NULL check.
This is what the static checker tells you but it could still mean the
other place is missing the check. The actual reason why this check is
superfluous is that the function is only used as ->doit() handler which
is never called with null info.
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
The subject should rather start with "ethtool: " (instead of "[net/ethtool] ").
For the change itself:
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Michal
> ---
> net/ethtool/linkmodes.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/net/ethtool/linkmodes.c b/net/ethtool/linkmodes.c
> index fd4f3e58c6f6..b595d87fa880 100644
> --- a/net/ethtool/linkmodes.c
> +++ b/net/ethtool/linkmodes.c
> @@ -406,8 +406,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;
> }
>
> --
> 2.17.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-07-31 22:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 4:58 [PATCH] [net/ethtool] ethnl_set_linkmodes: remove redundant null check Gaurav Singh
2020-07-31 13:54 ` Michal Kubecek [this message]
2020-08-03 22:12 ` 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=20200731135456.gbzznq6x2f5pznx6@carpenter.suse.cz \
--to=mkubecek@suse.cz \
--cc=andrew@lunn.ch \
--cc=ayal@mellanox.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=gaurav1086@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rempel-privat.de \
--cc=netdev@vger.kernel.org \
--cc=yuehaibing@huawei.com \
/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).