Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17935880ybl; Thu, 2 Jan 2020 15:08:12 -0800 (PST) X-Google-Smtp-Source: APXvYqy+rUFb7WRX4OLx5a9CGhK84Mzj7xRdaBTc0GTH+Sk6HsklyF4Tx3kKBYZUbRYYqQBikcS7 X-Received: by 2002:a9d:6b17:: with SMTP id g23mr91431861otp.265.1578006491851; Thu, 02 Jan 2020 15:08:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578006491; cv=none; d=google.com; s=arc-20160816; b=084lThdv6/VFh5OhHBzVniOagKpFF8X2liSIzosMi2utNtS8ejRMIzAF1JXOkLtRXv Y9fH4d8/A/Az6rsz8wgSDlB23aMTi7z+eOrXfQfqoi5+0fjhPXfkL8mnzr6DUzzX1VmN Nk3x9PAB46P+gnTi68Kenc+Cd2dT4bdzvpOh9HJmxzmiVsDS29r7wD15BxlFZglVnEYR 3BZoIyvOGtJy34kqtQIlZlrP+Vo4oRNzLdt8i2es6hNAInXQdIvOZFEaUaXKUuIzIrK+ MiY8KanyDzXEGe2cbng08/eo1K5AslGuikp5tjsd/YV32WzkKgfMHYG3TQu/jKwK7MAE gAaQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OJlQkgNqQewf5QXtp3ziQA6qg4UnyFn8tq4/LZiL/V4=; b=N2MTzCuxcNBZbaz+up4bLLHIVdGvZG3D2K98+AUyrUPXJUouSjEROEzjqHjWGJ1OR8 MOMtuSb2ni+Z56gwRSI4joQxg+kW/bpO6aEJwHnqyueUGF41x4AV5YuHUVYwl8vQ6Ya3 fNqnu0MGnhmmhx25txVuah4jZpodSwIeyeRKelXQs0lLOvkSi95N/6Sn0IJNJK6shIRP DjavMCQi/xfmiaUJheiULFeS9kM/DkQSp0sZasVCylzKvBmvoPruUb6G6fOXZLtqdhUp S4bz3mk5oFS8WRRvq8oV5RwBq0JRMo65fGU5SQAK79WqBBJ0VAEzi1UMex/MIR00bPG+ MoIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sL4VJNY3; 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 p25si29760193oto.191.2020.01.02.15.07.59; Thu, 02 Jan 2020 15:08:11 -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=@kernel.org header.s=default header.b=sL4VJNY3; 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 S1729169AbgABWWm (ORCPT + 99 others); Thu, 2 Jan 2020 17:22:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:43374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729029AbgABWWh (ORCPT ); Thu, 2 Jan 2020 17:22:37 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 85A2A20863; Thu, 2 Jan 2020 22:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003757; bh=jQybQAdyx9ZBDl/KAmYyeRIYex04N12HCfmKKKywYCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sL4VJNY3kVMN+vL5GzZ33LTalChpkCHg5zlZLsdnjk2smDCJ1Q3KyDt5TdYrV0rdl Y8bDP+c7ExauNX5XbfaY18x/bj8p2sa7UCbtiJctRRTaTnFrZI0rJaxrzprhaQzrGk wBcqkqDXbEuUdimeiodjdqXFHhg/9X1f9k550PC0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Lobakin , Daniel Borkmann , Sasha Levin Subject: [PATCH 4.19 075/114] net, sysctl: Fix compiler warning when only cBPF is present Date: Thu, 2 Jan 2020 23:07:27 +0100 Message-Id: <20200102220036.657934932@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Lobakin [ Upstream commit 1148f9adbe71415836a18a36c1b4ece999ab0973 ] proc_dointvec_minmax_bpf_restricted() has been firstly introduced in commit 2e4a30983b0f ("bpf: restrict access to core bpf sysctls") under CONFIG_HAVE_EBPF_JIT. Then, this ifdef has been removed in ede95a63b5e8 ("bpf: add bpf_jit_limit knob to restrict unpriv allocations"), because a new sysctl, bpf_jit_limit, made use of it. Finally, this parameter has become long instead of integer with fdadd04931c2 ("bpf: fix bpf_jit_limit knob for PAGE_SIZE >= 64K") and thus, a new proc_dolongvec_minmax_bpf_restricted() has been added. With this last change, we got back to that proc_dointvec_minmax_bpf_restricted() is used only under CONFIG_HAVE_EBPF_JIT, but the corresponding ifdef has not been brought back. So, in configurations like CONFIG_BPF_JIT=y && CONFIG_HAVE_EBPF_JIT=n since v4.20 we have: CC net/core/sysctl_net_core.o net/core/sysctl_net_core.c:292:1: warning: ‘proc_dointvec_minmax_bpf_restricted’ defined but not used [-Wunused-function] 292 | proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Suppress this by guarding it with CONFIG_HAVE_EBPF_JIT again. Fixes: fdadd04931c2 ("bpf: fix bpf_jit_limit knob for PAGE_SIZE >= 64K") Signed-off-by: Alexander Lobakin Signed-off-by: Daniel Borkmann Link: https://lore.kernel.org/bpf/20191218091821.7080-1-alobakin@dlink.ru Signed-off-by: Sasha Levin --- net/core/sysctl_net_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index d67ec17f2cc8..6cec08cd0bb9 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -281,6 +281,7 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, return ret; } +# ifdef CONFIG_HAVE_EBPF_JIT static int proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, @@ -291,6 +292,7 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, return proc_dointvec_minmax(table, write, buffer, lenp, ppos); } +# endif /* CONFIG_HAVE_EBPF_JIT */ static int proc_dolongvec_minmax_bpf_restricted(struct ctl_table *table, int write, -- 2.20.1