Commit 3f81c579 authored by Yang Li's avatar Yang Li Committed by David S. Miller

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.
Reported-by: default avatarAbaci Robot <abaci@linux.alibaba.com>
Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6789a4c0
...@@ -2766,7 +2766,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb) ...@@ -2766,7 +2766,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb)
rcu_read_lock_bh(); rcu_read_lock_bh();
amt = rcu_dereference_sk_user_data(sk); amt = rcu_dereference_sk_user_data(sk);
if (!amt) if (!amt)
goto drop; goto out;
if (amt->mode != AMT_MODE_GATEWAY) if (amt->mode != AMT_MODE_GATEWAY)
goto drop; goto drop;
...@@ -2788,6 +2788,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb) ...@@ -2788,6 +2788,7 @@ static int amt_err_lookup(struct sock *sk, struct sk_buff *skb)
default: default:
goto drop; goto drop;
} }
out:
rcu_read_unlock_bh(); rcu_read_unlock_bh();
return 0; return 0;
drop: drop:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment