Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1801665imm; Thu, 20 Sep 2018 03:10:22 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ1RFdTGTRv8Mvcc2laRl9aSGxosaw5g/o7QErwLq+JCWu58Lh5zTKbET6fTslakQG9xtVl X-Received: by 2002:a17:902:290a:: with SMTP id g10-v6mr38655828plb.110.1537438222850; Thu, 20 Sep 2018 03:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537438222; cv=none; d=google.com; s=arc-20160816; b=taJ4jMP1kHdo0ib0Jzo/7Sxgeo3z+BI/DWbxdK2FhpaL6but3fAFa8sMgaxQtLCUlK 8sszY2skwihA2YU7GE3E9hifY3qatJTQTwlQe0PFuQ9Dx+WZMEZ/CgJDy1DLcgzBlgkq ZJpk1kzE8JqqL7WUvNmBpCIMWO4JI//4sP8tAufP2FaokuS98hGnSNshrfn8rc63QHU6 qvXmkyIeQotIXmtm9gGiHEWi6oGs45RA7HZr3iLXzhPN+tRSK8rY10y0tQM4Y7rlo6qA 5Ak//rn9+0/cUEnZ28f5jpHuiUQeenHcdSqprm1IQrB7+7cTTsBZLb4SUb+upQGeAaKo r7ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=86C6APTMg77as4NgSi9+xY1a0fqo7NpqQnV54wdomhI=; b=c6lPd8VqcTbmjdgKokF568duUWWA+c+ktExa57MlgrSBRXrkShV/PZEZHTfdaXSLPJ qvv8GK4HKc32M/v1nHwaaF7n/spVl1MZRCbI7nYMfM4wRJcvnVecQ4MT2DEv6vK2BSrK oQrTgob67L4ann64owNXux7JcHizJ0+MU8R8RSAvi4U+XOoyLlSk8nlsCrxFeYbRJvyz so/bDFahd9rIWuWxo4oWZt1IxteY8tgbAr+rNJN+K7IH+XPadZME583yIliTJHDDKD+B Wa5qEgzUDn1TTANBYuyhDN1nJ/t/uImbFCvo3FwQtWNjOUsY3osq90+vYnNci+Bk7cc0 n4hQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e185-v6si23877927pgc.318.2018.09.20.03.10.07; Thu, 20 Sep 2018 03:10:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731492AbeITPw1 (ORCPT + 99 others); Thu, 20 Sep 2018 11:52:27 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12656 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730984AbeITPw1 (ORCPT ); Thu, 20 Sep 2018 11:52:27 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A5958C6369CED; Thu, 20 Sep 2018 18:09:39 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.399.0; Thu, 20 Sep 2018 18:09:38 +0800 From: zhong jiang To: , CC: , , Subject: [PATCH] crypto : chtls: remove redundant null pointer check before kfree_skb Date: Thu, 20 Sep 2018 17:57:16 +0800 Message-ID: <1537437436-43088-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kfree_skb has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before kfree_skb. Signed-off-by: zhong jiang --- drivers/crypto/chelsio/chtls/chtls_cm.c | 3 +-- drivers/crypto/chelsio/chtls/chtls_main.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/chelsio/chtls/chtls_cm.c b/drivers/crypto/chelsio/chtls/chtls_cm.c index 0997e16..fd2ae1e 100644 --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -234,8 +234,7 @@ static void chtls_send_reset(struct sock *sk, int mode, struct sk_buff *skb) return; out: - if (skb) - kfree_skb(skb); + kfree_skb(skb); } static void release_tcp_port(struct sock *sk) diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c index f59b044..f472c51 100644 --- a/drivers/crypto/chelsio/chtls/chtls_main.c +++ b/drivers/crypto/chelsio/chtls/chtls_main.c @@ -272,8 +272,7 @@ static void chtls_free_uld(struct chtls_dev *cdev) for (i = 0; i < (1 << RSPQ_HASH_BITS); i++) kfree_skb(cdev->rspq_skb_cache[i]); kfree(cdev->lldi); - if (cdev->askb) - kfree_skb(cdev->askb); + kfree_skb(cdev->askb); kfree(cdev); } -- 1.7.12.4