Skip to contentSkip to conversation

amt: Fix NULL but dereferenced coccicheck error

PATCH Applied Yang Li 2 participants 2 messages Nov 5, 2021

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 amt: Fix NULL but dereferenced coccicheck error

Eliminate the following coccicheck warning:
./drivers/net/amt.c:2795:6-9: ERROR: amt is NULL but dereferenced.

---
 drivers/net/amt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/amt.c +2 -1
index 896c9e2..cfd6c8c 100644
@@ -2766,7 +2766,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb)
 	rcu_read_lock_bh();
 	amt = rcu_dereference_sk_user_data(sk);
 	if (!amt)
-		goto drop;
+		goto out;
 
 	if (amt->mode != AMT_MODE_GATEWAY)
 		goto drop;
@@ -2788,6 +2788,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb)
 	default:
 		goto drop;
 	}
+out:
 	rcu_read_unlock_bh();
 	return 0;
 drop:
Signature · 1 line
1.8.3.1
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

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

Quoted 8 lines · On Fri, 5 Nov 2021 15:12:50 +0800 you wrote:

Eliminate the following coccicheck warning:
./drivers/net/amt.c:2795:6-9: ERROR: amt is NULL but dereferenced.

---
 drivers/net/amt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
- [-next] amt: Fix NULL but dereferenced coccicheck error

    https://git.kernel.org/netdev/net/c/3f81c5799128

You are awesome, thank you!

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