Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2222260ybl; Thu, 19 Dec 2019 09:59:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxKG1/4BWpJZxawt643Xw4il3MzYJhcOoNe9HPnDYTyriMm8BHOo38bc93K2A868k9a2R8n X-Received: by 2002:a05:6830:1e7c:: with SMTP id m28mr10320900otr.131.1576778375352; Thu, 19 Dec 2019 09:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576778375; cv=none; d=google.com; s=arc-20160816; b=dxZyLuvJKdqg6wmHSktnTVSzUmPloisNRChTKdfp/jjE1fG/Nd9lsfC+fDA0ibzc0b IY+wZD13DLpwo8x9rx7Lyumu9aiMmzCPAE567Zu3r6xvAMf5+UrQWscM3QTT+EgogpMf ldruQCVOZZ539M7oDraOZFsiOjoRzKc7PW6KkzXa3vr8GQvXQVtAK722pUwfd0yFquBV wZoaTVeA8Wot2UECqzk77QDaxlR+xOo+4/Kzr/Vly37+dQWQq8tIsTyaJPTVYCT9yD9K KX6TusXuLUL+Fy4YSo3iXiaNKK3fX6PAM9+qNfAOsVeqRxylBFTh6s0E61BVET2WkhiJ bF2A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=JwhEB9Dx/uNy1TVdO49rVoEq5ZejBIq7czTQQQLig8s=; b=EORDleYVcRyhKZz/AfPWL4p6B66Ly34tZkQrdRo9QKHM+epTWcaCysaX3Pj1QB5H/G ixYWAMYHJNshcqNA1OMz5cP2V68bEpxxU8O2Mb7tcELk31hrYqIuClMqdQRuPaAbU75T f/0UqdX4D2LJM31/bpGY9OPU362wzKDe33hTccD59wjRIrV57SpPogNgqAHs+tQ0Y1ST WFaY3sAY1hJfQEMXiOnooPAqsj4rBlilUiXedYneGY85Pruk10//+IoB052Dxkd4vH8m zs/GVkGYVBaZMoVWxhS9Oh9XHPECDEihjjWCAcjG49JJiSSDQEJ8gP2dWZDGd2WIigUl mU+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=lnNs6bUq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si556094otr.308.2019.12.19.09.59.20; Thu, 19 Dec 2019 09:59:35 -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; dkim=pass header.i=@umn.edu header.s=google header.b=lnNs6bUq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726908AbfLSR5k (ORCPT + 99 others); Thu, 19 Dec 2019 12:57:40 -0500 Received: from mta-p7.oit.umn.edu ([134.84.196.207]:60872 "EHLO mta-p7.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726875AbfLSR5k (ORCPT ); Thu, 19 Dec 2019 12:57:40 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p7.oit.umn.edu (Postfix) with ESMTP id 47f02q43Htz9vZvG for ; Thu, 19 Dec 2019 17:57:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p7.oit.umn.edu ([127.0.0.1]) by localhost (mta-p7.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VAgMhdx7sdm6 for ; Thu, 19 Dec 2019 11:57:39 -0600 (CST) Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p7.oit.umn.edu (Postfix) with ESMTPS id 47f02q2pgPz9vYxx for ; Thu, 19 Dec 2019 11:57:39 -0600 (CST) Received: by mail-yb1-f199.google.com with SMTP id e11so4605925ybn.12 for ; Thu, 19 Dec 2019 09:57:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JwhEB9Dx/uNy1TVdO49rVoEq5ZejBIq7czTQQQLig8s=; b=lnNs6bUqQMHO46MODGi8ofRYuxKCRllWB9uUhsAii4PrWq7hDLXNvFVWddmE7b5fZM QMSDklstNrnK4/yQx7TvERwZxyaKKokRInOc60mcqaM6KxftlMUgQOStiTvK03hcteEr kMA9IcFyvBV8DBKy2/Iw+lB39gS9HQvsHzQzepVnt3bzSVzYK3/rG9PGm9oCXfubn3vR RZ8p+YaQ2Yf9GwgwCQ2kiD15kgrndZlyV5ReOSVUMHv7Ko/qC+4Mu/sKy+7lbzVhNiDS Hp/87ZOQXytfDuM7UKINhjo3pgrg2IsQ0Iptl5Z6P+wQ/IHi25NMJukl8m0Ov9zxJvu+ NfTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JwhEB9Dx/uNy1TVdO49rVoEq5ZejBIq7czTQQQLig8s=; b=qfY8KYIZZmUFq5PkBKyrC1dO/ZrSA2xDfIypG0XLBnjvi/qHee2sBaPg5QhANFdpN8 kVKxus2lsk1mt4v4gJjXT2uRLqlNBwL7+rmcwd/6Y+wZRH4JcVm3KObKyl+UItnzQyVd XKjjIjgy7sh10s+iYIDUM7ESs4avEXiDuT+K0n/SoUnlPtW1BFPCAodOITsEw1ho3sXQ KfyNL0aa6Mgd39bm2y+Rzm2Aw2N0u68rez2uGPOAatX9Ovt/BIS/1tn8JUmy3jzJn5Aq 7rDgZQ3e8mmievzywTZJ+NunkPdqDg3oo1QZMky8ZDzi2XTIJAce0K6OsMmUQGpXJ8UR X7Hw== X-Gm-Message-State: APjAAAXhpb6T8DcKhaxXK00ydw2yA6mN0QTd+Wb8M9FO48TxUpbMrjUa CPr5Oo0puLkrrVeBdKW9NICEu9QYz59DPJ9N9Dv1og+o2cJ+r8hYThaWiVHDlWulWJvCnMeH8ZR DDiQ1yTdRYyMrTIaecMbTXOv0nIYf X-Received: by 2002:a25:b90b:: with SMTP id x11mr6879863ybj.209.1576778258883; Thu, 19 Dec 2019 09:57:38 -0800 (PST) X-Received: by 2002:a25:b90b:: with SMTP id x11mr6879838ybj.209.1576778258545; Thu, 19 Dec 2019 09:57:38 -0800 (PST) Received: from cs-u-syssec1.dtc.umn.edu (cs-u-syssec1.cs.umn.edu. [128.101.106.66]) by smtp.gmail.com with ESMTPSA id l39sm2831320ywk.36.2019.12.19.09.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 09:57:38 -0800 (PST) From: Aditya Pakki To: pakki001@umn.edu Cc: kjlu@umn.edu, Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] bpf: Remove unnecessary assertion on fp_old Date: Thu, 19 Dec 2019 11:57:35 -0600 Message-Id: <20191219175735.19231-1-pakki001@umn.edu> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The two callers of bpf_prog_realloc - bpf_patch_insn_single and bpf_migrate_filter dereference the struct fp_old, before passing it to the function. Thus assertion to check fp_old is unnecessary and can be removed. Signed-off-by: Aditya Pakki --- v1: Remove the check on fp_old altogether, as suggested by Daniel Borkmann and Alexei Starovoitov. --- kernel/bpf/core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 49e32acad7d8..ca010b783687 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -222,8 +222,6 @@ struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size, u32 pages, delta; int ret; - BUG_ON(fp_old == NULL); - size = round_up(size, PAGE_SIZE); pages = size / PAGE_SIZE; if (pages <= fp_old->pages) -- 2.20.1