Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1783456imm; Thu, 20 Sep 2018 02:51:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbZLH438Wg7sa82jy43tx5n3S6ODOXKrE5R2njYZd9zKMASMxYZ1EFF6N1Fw7VcvFSAiGGb X-Received: by 2002:a65:5089:: with SMTP id r9-v6mr5973606pgp.216.1537437068490; Thu, 20 Sep 2018 02:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537437068; cv=none; d=google.com; s=arc-20160816; b=BqOQerY4TNxK/fSkgESeDif9/2vWvwrLRWxKxykjhZJIK8wmUiv84qNY68FlRsy+Jr 4XV4dV9nzVH7y4BPP6XZiT1fdMIwxrSpt2K2qfr8FLyKxnXycJlsA2+rGMp1UzRSGOvt zlUj+R9i9VqKZLUlECcqGk3BP1kb/5IAovJCiTRlnRKt1MMwEy4ngZqsdtjMzHHkpTtY zXdyUa9+rm7cTGY6OP6cFSOUIPpzZrJpIHjABsCLHFGuK+o532h7naJsWQNvgpT/ufD1 xEgZMZCMqnFk0/rX2yM/gOt64AInFv8eWVC+OI/zYmbjBwUmr6gJudRpV1M/jMpK716R RLLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=p7uNHjmVXtpWTB65f+HkMkZbDPG7jz5cdcRCgt4Vilk=; b=F+SXw6ZGC7URS+9YAinh0grN0TE8h96R2uba4aYd3DOz0BLPYxcUmToN2D0mItf48w crUQpohMt8c9d3/4FeG5n6iMR/AZlfJRsCXKDPWf52ODxebGx4UDeTH+nQ6Ex21MJViq PLY9zeJ+VdEtyvlf8x4kTL3vRM76aitbLJ09I/oToKOMM36CqDjtm3H8f6ZnudAxGIRU RsdrdhL0DKp5CA2Vu9wLh+nLwSfEHVPQbnY8oPFcAAfCqX1V0jRwjt6sLguxv/ExuGWX t7EOy76UeCIQmBVXNIDiuSr//X/xzJoJxu+DT/9FfT5oSxYirkT1FgjDaBu6E1tcMPde 6veg== 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 a65-v6si22745484pge.694.2018.09.20.02.50.53; Thu, 20 Sep 2018 02:51:08 -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 S2387468AbeITPcy (ORCPT + 99 others); Thu, 20 Sep 2018 11:32:54 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12634 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731595AbeITPcx (ORCPT ); Thu, 20 Sep 2018 11:32:53 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id ADBDC373C4C9A; Thu, 20 Sep 2018 17:50:12 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 20 Sep 2018 17:50:12 +0800 From: zhong jiang To: CC: , , , , Subject: [PATCH 6/6] ipv6: remove redundant null pointer check before kfree_skb Date: Thu, 20 Sep 2018 17:37:46 +0800 Message-ID: <1537436266-41955-7-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1537436266-41955-1-git-send-email-zhongjiang@huawei.com> References: <1537436266-41955-1-git-send-email-zhongjiang@huawei.com> 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 --- net/ipv6/af_inet6.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 77ef847..e9c8cfd 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -468,12 +468,10 @@ void inet6_destroy_sock(struct sock *sk) /* Release rx options */ skb = xchg(&np->pktoptions, NULL); - if (skb) - kfree_skb(skb); + kfree_skb(skb); skb = xchg(&np->rxpmtu, NULL); - if (skb) - kfree_skb(skb); + kfree_skb(skb); /* Free flowlabels */ fl6_free_socklist(sk); -- 1.7.12.4