Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2606425pxb; Fri, 5 Nov 2021 01:14:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyL6yLtlUzPIp4rNnnUNcSBFz8t6eBUPyJmKrVpm7pq9ltfTNcXSyvp/f/R2HYTxoBbTXHQ X-Received: by 2002:a17:906:3d62:: with SMTP id r2mr68681265ejf.174.1636100052725; Fri, 05 Nov 2021 01:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636100052; cv=none; d=google.com; s=arc-20160816; b=t5C+F88Ur/yy2B11YgkDd5Qmu77g84ZJFbHJIy1ykNuf8D39LQ9vj42RFvXbXacnsz FNEAfe+g12BagJyrarBtLUQUaaJXfvBvVlUg2+JvCg1CEwjpT6OzOOZ1WCy5W6eu9GQV CEOzusV1hHIHNqemZySNJGmB8Pfd4sVuKHHKVSwLvzk0cTakkcfmLP7lOKSQtGDmDgL0 4tdoR4GxAP+th72zFoxXMblXqC08XG6Pf2NDyo9YVkD78DoDhMBdsMDyaP+/jzs39osw 7zEsqTUgzBXPjK5NEiwb0/iY04e+BeZGhMig/si8txVuThxtws7+GQefqvd7N05MOvlG SznA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=4XBg2mGD/oU0iPQQsukpChpWJGnR/xZzla4q2nZ+YA0=; b=ILQKZsrTD7P3OEzLdLCfK9KT4nMQ4XBZxnEdXdPtZEOynlgrUrm849wQ/Aer0aNhnh bvJXCu9JFutaS2yRFL1QO3qWTtrRfLUO4NU1iFZlkPcl1cWdhXbaX/Q0GCqGD0SBuKoi wLBHqzHQSfNEf/Cxel/x4gBRFxXdP2QpyHgxDHy1zIgBDC5wOJkCV8Y5XpVI6hWuWRwr iySx1pomdFd40vycuNm1miJZN6bPTk7H+8lFQw1lB0t7cFHqtL1MYNhaPoT2djHmhe7B ZIgr7qgF/1YPrE2/yDFblMaa7/7MAt+E/9oJM0/H1ESIpd3loohZIHXs8OxINcwXkrzt kspw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr20si15150712ejc.526.2021.11.05.01.13.47; Fri, 05 Nov 2021 01:14:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232528AbhKEHPi (ORCPT + 99 others); Fri, 5 Nov 2021 03:15:38 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:39495 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231403AbhKEHPh (ORCPT ); Fri, 5 Nov 2021 03:15:37 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Uv7vdPe_1636096374; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0Uv7vdPe_1636096374) by smtp.aliyun-inc.com(127.0.0.1); Fri, 05 Nov 2021 15:12:56 +0800 From: Yang Li To: ap420073@gmail.com Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH -next] amt: Fix NULL but dereferenced coccicheck error Date: Fri, 5 Nov 2021 15:12:50 +0800 Message-Id: <1636096370-19862-1-git-send-email-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eliminate the following coccicheck warning: ./drivers/net/amt.c:2795:6-9: ERROR: amt is NULL but dereferenced. Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/net/amt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- 1.8.3.1