diff mbox series

[linux-next] net/core: Remove unused assignment operations and variable

Message ID 20211021064020.1047324-1-luo.penghao@zte.com.cn (mailing list archive)
State Accepted
Commit 50af5969bb22bb8ea757f87934c2478715afa854
Delegated to: Netdev Maintainers
Headers show
Series [linux-next] net/core: Remove unused assignment operations and variable | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present success Fixes tag not required for -next series
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 7 maintainers not CCed: cong.wang@bytedance.com dsahern@kernel.org yajun.deng@linux.dev johannes.berg@intel.com avagin@gmail.com lschlesinger@drivenets.com zhudi21@huawei.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: luo penghao <cgel.zte@gmail.com>' != 'Signed-off-by: luo penghao <luo.penghao@zte.com.cn>'
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

CGEL Oct. 21, 2021, 6:40 a.m. UTC
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(-)

Comments

Simon Horman Oct. 21, 2021, 10:44 a.m. UTC | #1
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>
patchwork-bot+netdevbpf@kernel.org Oct. 21, 2021, 11:50 a.m. UTC | #2
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!
diff mbox series

Patch

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;