netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] mctp: Fix warnings reported by clang-analyzer
@ 2022-02-22  4:29 Matt Johnston
  2022-02-23 12:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Johnston @ 2022-02-22  4:29 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Jakub Kicinski, Jeremy Kerr

net/mctp/device.c:140:11: warning: Assigned value is garbage or undefined
[clang-analyzer-core.uninitialized.Assign]
        mcb->idx = idx;

- Not a real problem due to how the callback runs, fix the warning.

net/mctp/route.c:458:4: warning: Value stored to 'msk' is never read
[clang-analyzer-deadcode.DeadStores]
        msk = container_of(key->sk, struct mctp_sock, sk);

- 'msk' dead assignment can be removed here.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
---
 net/mctp/device.c | 2 +-
 net/mctp/route.c  | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/mctp/device.c b/net/mctp/device.c
index 9e097e61f23a..224f067e9d4c 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -107,7 +107,7 @@ static int mctp_dump_addrinfo(struct sk_buff *skb, struct netlink_callback *cb)
 	struct ifaddrmsg *hdr;
 	struct mctp_dev *mdev;
 	int ifindex;
-	int idx, rc;
+	int idx = 0, rc;
 
 	hdr = nlmsg_data(cb->nlh);
 	// filter by ifindex if requested
diff --git a/net/mctp/route.c b/net/mctp/route.c
index fe6c8bf1ec2c..85acfcbabd9c 100644
--- a/net/mctp/route.c
+++ b/net/mctp/route.c
@@ -456,7 +456,6 @@ static int mctp_route_input(struct mctp_route *route, struct sk_buff *skb)
 		 * the reassembly/response key
 		 */
 		if (!rc && flags & MCTP_HDR_FLAG_EOM) {
-			msk = container_of(key->sk, struct mctp_sock, sk);
 			sock_queue_rcv_skb(key->sk, key->reasm_head);
 			key->reasm_head = NULL;
 			__mctp_key_done_in(key, net, f, MCTP_TRACE_KEY_REPLIED);
-- 
2.32.0


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

* Re: [PATCH net-next] mctp: Fix warnings reported by clang-analyzer
  2022-02-22  4:29 [PATCH net-next] mctp: Fix warnings reported by clang-analyzer Matt Johnston
@ 2022-02-23 12:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-23 12:40 UTC (permalink / raw)
  To: Matt Johnston; +Cc: netdev, davem, kuba, jk

Hello:

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

On Tue, 22 Feb 2022 12:29:36 +0800 you wrote:
> net/mctp/device.c:140:11: warning: Assigned value is garbage or undefined
> [clang-analyzer-core.uninitialized.Assign]
>         mcb->idx = idx;
> 
> - Not a real problem due to how the callback runs, fix the warning.
> 
> net/mctp/route.c:458:4: warning: Value stored to 'msk' is never read
> [clang-analyzer-deadcode.DeadStores]
>         msk = container_of(key->sk, struct mctp_sock, sk);
> 
> [...]

Here is the summary with links:
  - [net-next] mctp: Fix warnings reported by clang-analyzer
    https://git.kernel.org/netdev/net-next/c/8d783197f06d

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] 2+ messages in thread

end of thread, other threads:[~2022-02-23 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22  4:29 [PATCH net-next] mctp: Fix warnings reported by clang-analyzer Matt Johnston
2022-02-23 12:40 ` patchwork-bot+netdevbpf

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