Skip to contentSkip to conversation

mctp: Fix warnings reported by clang-analyzer

PATCH Applied Matt Johnston 2 participants 2 messages Feb 22, 2022 – Feb 23, 2022

Subsystems (3)
lore
Share & tools
lore

Matt Johnston

author maintainer
#0 lore raw

PATCH 1/1 mctp: Fix warnings reported by clang-analyzer

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.

---
 net/mctp/device.c | 2 +-
 net/mctp/route.c  | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
net/mctp/device.c +1 -1
index 9e097e61f23a..224f067e9d4c 100644
@@ -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
net/mctp/route.c +0 -1
index fe6c8bf1ec2c..85acfcbabd9c 100644
@@ -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);
Signature · 1 line
2.32.0
#1 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 11 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html