Received: by 10.223.185.116 with SMTP id b49csp834840wrg; Fri, 23 Feb 2018 07:32:07 -0800 (PST) X-Google-Smtp-Source: AH8x226qR6qeNguOB+GRCWmLbASXjcHYOZO/kxt/iXXYZQaDzDbN7z8A/ZA9eFi2NKMfnOr1gbqE X-Received: by 2002:a17:902:aa5:: with SMTP id 34-v6mr2090716plp.429.1519399927359; Fri, 23 Feb 2018 07:32:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519399927; cv=none; d=google.com; s=arc-20160816; b=q9uvUGE5R4CY3kzmqIQJzdoV7eA5CeQ0PvOaaTi69NBl4ght11jlLenE1S+pMG9A0H tfkhK1rpOJYda6pM7Bvqg/7rtny4QZuh2TnXMAQLJJ+eVDrVRMucgTSdG3u07IKjvUo/ wagT+DFs4YEXX/Bp6pT8M92tZW9sAnfKlaxtzgqFFpRDSgAwJ0Ena68RygctqRtcDnc3 Fx89hmP/0n2GFLQ2y3v0SmMBsIzbj/crBvPnwsNI8cjHV7Mkt+K2aimlaAYPeemejQXU 5qQ1ns6tmv82VGmbafHRjXtZE/mNevelWBfBf+bop5aAGgI2gSk0m0bFrzv+sboVP+5C Sdkg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=fm/vPB4soFu4KeqYa2C4nLXeaO5iMH9VAd2iJg1vAyc=; b=Zich+3KZYP1MJbRu429sR4OgGOeIoZ+WHGtltrWGIVDRW2vLgdjUnlbJzYZtCfzOei y68UoYIKBaxxD5tQCbw8tWkDB/lpe1VS7BHd2LepV96PBzH6vULaOPD8Le758+Llt+mY zxhprpOKKf1lyMa6KdpQyc3rNk0aPbyiqgcNZXMbo90LGaVI62wL7JBlkiXrxSZn214Y o0BppW+FEMU11pRrTU0sE97lh8DY14t7R9jC/AOAX3oqnKm2YrCr5rBkzjdGqM1601DG /4y+bjbrhb7rzi+rxVCLCw5TM+p2wBipBj+SXgCSUQjjg5LN1iaK0tnyjioYdLUXRe6L yMmA== 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 n10si1634192pgc.721.2018.02.23.07.31.52; Fri, 23 Feb 2018 07:32:07 -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 S1751750AbeBWPan (ORCPT + 99 others); Fri, 23 Feb 2018 10:30:43 -0500 Received: from www62.your-server.de ([213.133.104.62]:43005 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbeBWPam (ORCPT ); Fri, 23 Feb 2018 10:30:42 -0500 Received: from [62.202.221.135] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1epFJ0-0004q4-Ni; Fri, 23 Feb 2018 16:30:39 +0100 Subject: Re: [PATCH bpf-next] bpf: NULL pointer check is not needed in BPF_CGROUP_RUN_PROG_INET_SOCK To: Yafang Shao , dsa@cumulusnetworks.com, ast@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1519369121-22269-1-git-send-email-laoar.shao@gmail.com> From: Daniel Borkmann Message-ID: <5ccc063c-6b71-0093-5312-c6d1e96fabd3@iogearbox.net> Date: Fri, 23 Feb 2018 16:30:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1519369121-22269-1-git-send-email-laoar.shao@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.3/24341/Fri Feb 23 10:13:36 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/2018 07:58 AM, Yafang Shao wrote: > 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 Agree, applied to bpf-next, thanks Yafang!