Received: by 10.223.185.116 with SMTP id b49csp979945wrg; Fri, 23 Feb 2018 09:47:15 -0800 (PST) X-Google-Smtp-Source: AH8x2254BTAEEgvHGOjSOqOqBBW1SJv5rSqMl1wumTg0cQjI7JEZq03WAP5+gMiB367QVCDjFYO+ X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr2399724pld.72.1519408034901; Fri, 23 Feb 2018 09:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519408034; cv=none; d=google.com; s=arc-20160816; b=dMLD7uO1j5JWeQpGMSoQMW+jae5ON+QKOX0bmeloEiF7bAOnEdDd9wn0QUu7hCDk1M IpZMEp3nCqy49D3UrtROMBtVIrq9WxR9DQjqZtny1cWasstsdMcYSkbyQIGzKS23/Srb I+HDTxQcmyRJvorYZc/V3Ob56XyAjyKPW7aOAIWtNPBBi5bISqfl5IIubLpZ02Ko5IX0 OzQYjFbgWzR9DQhzYU5LhxFaiVeREETeEAENmZElHwxe0ZPch1sslswhOqqxpl28Swwq AXGGqCSzQMrekAnao+K1YO78gVgy33q/3ujMSDhjLgTdMc3l1RHmVwZmI1C40M3GRqHv Wt6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=Z2M4YnjHkNVvUQ28Wfe2FpEVp5YZ0o4xTDBzQzYfLx4=; b=XOV3u5ur0+ZkAl7pEtA5hA+gJhHUcwJ6/D5dLvsG+VsMGN++hyNEHZ7YKR1Wvt/vCB AfWs/BG1HReDvhHnGX2p/BIQNzJQcrdR4RPoKkl3vUUNPgVm1wjnYymlF3yOlKKXa8+r aVEHmyIY7PjEMzqOBwAQ3jCZgP9Zaznk4lUkvUVPJBjmaH1g2WjJb92PHz2Lsn+vFTPC hPbnTqRGxjARBcJwboc2/DadHOv/ljwZVqHSVvKO1gwD0RlFjAJcn/12RLrzP6RAaIAH Ml5cwveCgM7uiVtNXPcitPukkMWqST48CvBGM4zw56OWttv2zG/Uj4B5wcpuKLjIj9xh yL5Q== 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 20si2122655pfp.312.2018.02.23.09.47.00; Fri, 23 Feb 2018 09:47:14 -0800 (PST) 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 S1751980AbeBWRo6 (ORCPT + 99 others); Fri, 23 Feb 2018 12:44:58 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:35530 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751468AbeBWRo4 (ORCPT ); Fri, 23 Feb 2018 12:44:56 -0500 Received: from localhost (67.110.78.66.ptr.us.xo.net [67.110.78.66]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 29BDA13C4D21B; Fri, 23 Feb 2018 09:44:56 -0800 (PST) Date: Fri, 23 Feb 2018 12:44:55 -0500 (EST) Message-Id: <20180223.124455.1183789000029287041.davem@davemloft.net> To: laoar.shao@gmail.com Cc: dsa@cumulusnetworks.com, ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next] bpf: NULL pointer check is not needed in BPF_CGROUP_RUN_PROG_INET_SOCK From: David Miller In-Reply-To: <1519369121-22269-1-git-send-email-laoar.shao@gmail.com> References: <1519369121-22269-1-git-send-email-laoar.shao@gmail.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 23 Feb 2018 09:44:56 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yafang Shao Date: Fri, 23 Feb 2018 14:58:41 +0800 > sk is already allocated in inet_create/inet6_create, hence when > BPF_CGROUP_RUN_PROG_INET_SOCK is executed sk will never be NULL. > > The logic is as bellow, > sk = sk_alloc(); > if (!sk) > goto out; > BPF_CGROUP_RUN_PROG_INET_SOCK(sk); > > Signed-off-by: Yafang Shao Acked-by: David S. Miller