linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] net/core: Remove unused assignment operations and variable
@ 2021-10-21  6:40 luo penghao
  2021-10-21 10:44 ` Simon Horman
  2021-10-21 11:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: luo penghao @ 2021-10-21  6:40 UTC (permalink / raw)
  To: SimonHorman
  Cc: David S . Miller, Jakub Kicinski, Stephen Rothwell, netdev,
	linux-kernel, luo penghao, Zeal Robot

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: luo penghao <luo.penghao@zte.com.cn>
---
 net/core/rtnetlink.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 10e2a0e..c218ad0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3807,9 +3807,8 @@ 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);
 	if (skb == NULL)
 		goto errout;
 
-- 
2.15.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH linux-next] net/core: Remove unused assignment operations and variable
  2021-10-21  6:40 [PATCH linux-next] net/core: Remove unused assignment operations and variable luo penghao
@ 2021-10-21 10:44 ` Simon Horman
  2021-10-21 11:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Horman @ 2021-10-21 10:44 UTC (permalink / raw)
  To: luo penghao
  Cc: David S . Miller, Jakub Kicinski, Stephen Rothwell, netdev,
	linux-kernel, luo penghao, Zeal Robot

On Thu, Oct 21, 2021 at 06:40:20AM +0000, luo penghao wrote:

I think the bracketed part of the subject of your emails should be:

[PATCH v2 net-next]

* IIRC this is v2 of the patch
* The patch is targeted at the net-next tree

> 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: luo penghao <luo.penghao@zte.com.cn>

The above not withstanding, this patch looks correct to me.

Reviewed-by: Simon Horman <horms@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH linux-next] net/core: Remove unused assignment operations and variable
  2021-10-21  6:40 [PATCH linux-next] net/core: Remove unused assignment operations and variable luo penghao
  2021-10-21 10:44 ` Simon Horman
@ 2021-10-21 11:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-21 11:50 UTC (permalink / raw)
  To: luo penghao
  Cc: horms, davem, kuba, sfr, netdev, linux-kernel, luo.penghao, zealci

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 21 Oct 2021 06:40:20 +0000 you wrote:
> 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:
> 
> [...]

Here is the summary with links:
  - [linux-next] net/core: Remove unused assignment operations and variable
    https://git.kernel.org/netdev/net-next/c/50af5969bb22

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH linux-next] net/core: Remove unused assignment operations and variable
  2021-10-18  9:13 luo penghao
@ 2021-10-20  9:21 ` Simon Horman
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2021-10-20  9:21 UTC (permalink / raw)
  To: luo penghao
  Cc: David S . Miller, Jakub Kicinski, Stephen Rothwell, netdev,
	linux-kernel, penghao luo, Zeal Robot

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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH linux-next] net/core: Remove unused assignment operations and variable
@ 2021-10-18  9:13 luo penghao
  2021-10-20  9:21 ` Simon Horman
  0 siblings, 1 reply; 5+ messages in thread
From: luo penghao @ 2021-10-18  9:13 UTC (permalink / raw)
  To: David S . Miller
  Cc: Jakub Kicinski, Stephen Rothwell, netdev, linux-kernel,
	penghao luo, Zeal Robot

From: penghao luo <luo.penghao@zte.com.cn>

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);
 	if (skb == NULL)
 		goto errout;
 
-- 
2.15.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-21 11:50 UTC | newest]

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

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).