All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: luo penghao <cgel.zte@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	penghao luo <luo.penghao@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux-next] net/core: Remove unused assignment operations and variable
Date: Wed, 20 Oct 2021 11:21:25 +0200	[thread overview]
Message-ID: <20211020092124.GE3935@kernel.org> (raw)
In-Reply-To: <20211018091356.858036-1-luo.penghao@zte.com.cn>

On Mon, Oct 18, 2021 at 09:13:56AM +0000, luo penghao wrote:
> From: penghao luo <luo.penghao@zte.com.cn>

I think the correct patch prefix for this patch would be:

[PATCH net-next] rtnetlink:

> Although if_info_size is assigned, it has not been used. And the variable
> should also be deleted.
> 
> The clang_analyzer complains as follows:
> 
> net/core/rtnetlink.c:3806: warning:
> 
> Although the value stored to 'if_info_size' is used in the enclosing expression,
> the value is never actually read from 'if_info_size'.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: penghao luo <luo.penghao@zte.com.cn>
> ---
>  net/core/rtnetlink.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 327ca6b..52dc51a 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -3804,9 +3804,9 @@ struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,
>  	struct net *net = dev_net(dev);
>  	struct sk_buff *skb;
>  	int err = -ENOBUFS;
> -	size_t if_info_size;
>  
> -	skb = nlmsg_new((if_info_size = if_nlmsg_size(dev, 0)), flags);
> +
> +	skb = nlmsg_new((if_nlmsg_size(dev, 0)), flags);

I think you can also drop the parentheses around the call to if_nlmsg_size.

>  	if (skb == NULL)
>  		goto errout;
>  
> -- 
> 2.15.2
> 

  reply	other threads:[~2021-10-20  9:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18  9:13 [PATCH linux-next] net/core: Remove unused assignment operations and variable luo penghao
2021-10-20  9:21 ` Simon Horman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-21  6:40 luo penghao
2021-10-21 10:44 ` Simon Horman
2021-10-21 11:50 ` patchwork-bot+netdevbpf

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=20211020092124.GE3935@kernel.org \
    --to=horms@kernel.org \
    --cc=cgel.zte@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luo.penghao@zte.com.cn \
    --cc=netdev@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=zealci@zte.com.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.