diff mbox series

[-next] amt: Fix NULL but dereferenced coccicheck error

Message ID 1636096370-19862-1-git-send-email-yang.lee@linux.alibaba.com (mailing list archive)
State Accepted
Commit 3f81c579912855f19ed1a72af8133485a6119fba
Delegated to: Netdev Maintainers
Headers show
Series [-next] amt: Fix NULL but dereferenced coccicheck error | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Yang Li Nov. 5, 2021, 7:12 a.m. UTC
Eliminate the following coccicheck warning:
./drivers/net/amt.c:2795:6-9: ERROR: amt is NULL but dereferenced.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/net/amt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 5, 2021, 10:50 a.m. UTC | #1
Hello:

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

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.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  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!
diff mbox series

Patch

diff --git a/drivers/net/amt.c b/drivers/net/amt.c
index 896c9e2..cfd6c8c 100644
--- a/drivers/net/amt.c
+++ b/drivers/net/amt.c
@@ -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: