Received: by 10.223.185.116 with SMTP id b49csp1142007wrg; Tue, 20 Feb 2018 14:10:42 -0800 (PST) X-Google-Smtp-Source: AH8x225hG2h14pCA/OvS7iRsypXtdQa8tvFyp/xq93PWVjQ1YZBxayG83jmU5X2XEfOHr2xTYA68 X-Received: by 10.98.144.65 with SMTP id a62mr1063245pfe.96.1519164642505; Tue, 20 Feb 2018 14:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519164642; cv=none; d=google.com; s=arc-20160816; b=b0Vg/U2JDOx69E5yYTxxLPS59ADBqUlJ+ah22669ZqDRiZxZFcwnyHNQfJfjQZiA1u MiwVFNxRQaOluFJaYJInzzl7u2Li+0iTW/158KRbaTMZD9mDAoFCvkZErcXbWjxwovVz oyVPYxpFKuzffYUxJX77zP/B4FUr1/OAOYEU1acxMwLAflIvgC8Mm07nZWCX/OhEiXRD FOtOb/tPXNXQtJH114b0Ov8ddocO3eitzVupKcObz2N93BfGGCa13it/ZXVPD8+22ROI 9su4fC5mnXSfKHOsG3ShuDNAzOjPuSTUzhsjcUkFiRU65GLnbUu6XGsNmM5sxrNbAT9s cwNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=OeAT9NDxc7ZxiZkFROE0BzvAW0orEckcq0G0CdoxIAc=; b=rRg4zF57eFz/sqzyoPo7mpmA0X2SWtunzX0atn+gbUoVz1jCUwFziSYQ5YSqerN/u1 nOs8MDkkShqn8n3DQUpFWOLPct0kljkr0Jo2+Cw/5niP2WlMO1uUXJ2TrWIPQDMhYXjM 6LEJMKojorEWqOy9gqvayx+jOjgPVZvaTxmzOuLgbG4rD0crKvDMH1TIKi9X/S0m1bpn px2PxNfg7jT7l6AuIbN4wOtnGeB9wLeliR7AAaJacpENlvHW6iiHgSdYybO+IQCoIW5P GifwCwqrug+WIIMQ0NMmW1qLD/VQhG6zyKOyxTU2ICMIN6ukl8Wxjr6ZqJBN01g3vXb+ AJSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=DEfNlPCN; 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 f4si4240714pgn.334.2018.02.20.14.10.18; Tue, 20 Feb 2018 14:10:42 -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=fail header.i=@gmail.com header.s=20161025 header.b=DEfNlPCN; 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 S1751404AbeBTWIv (ORCPT + 99 others); Tue, 20 Feb 2018 17:08:51 -0500 Received: from mail-qk0-f195.google.com ([209.85.220.195]:41313 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751350AbeBTWIt (ORCPT ); Tue, 20 Feb 2018 17:08:49 -0500 Received: by mail-qk0-f195.google.com with SMTP id h129so18493927qke.8; Tue, 20 Feb 2018 14:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=OeAT9NDxc7ZxiZkFROE0BzvAW0orEckcq0G0CdoxIAc=; b=DEfNlPCN8RBns2r5SRLNqFuO5ID7KE/8BHOyy15/n/B0gqc8hdDy1vQouXTvzYWyjy gLx7qb6X6D213GK3nfgAOLqknyNpRw/RFXuniGLFQrRJfoKXasr0dglEwldCKhQ7cTwD 8LviBH328b39RxxCzC87yzjawmFEUkwBgYvUKFZom4xdx9mTZQOHSWVLYU7mJd7UseHL 0Q0hKss9L6F0qXs0m7XNcUL7uXF+nGxtlkfDPqeCpSc/XHLaJfHupcO6AOf36BOhsxta HGAr+ft7GYPOaUs4+eI8AxjAmm77mtlAnGJBvwbbah/uiZG56yqdnBytNmwbuTc00SwH Jr0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=OeAT9NDxc7ZxiZkFROE0BzvAW0orEckcq0G0CdoxIAc=; b=UWNnJFwVbZtXX8CKJ41P/SqjpXTmf97GxguIT0sFdTiSp600jZTb5ATY61ZF/15goe l+7obey8n0UI0WrcGG3LeumjHKwK8snwrIjHQq57EwPd1KJsH0paloiaeRP/TTvZYDEg o2/mki3UOPDQJkt1K0dkR1fR5StcHBhBwqH9Xj8y+xzLzUcu8Gjdp0wL6zG8MOZTvNIi quttjI2JvICByp1Ng/h/k99E2JN6XagLPir1L0ymE6dBPPPxvtF+eQNg7oVJ/41KDoyn Kmc1pHhW5yWzA2rZrqnobBxJh2M69w31KTTJ6l+WEO7ldiyqn+qypcMVVSQwA5KNARkk htIA== X-Gm-Message-State: APf1xPAgyLUHJIJc2Qt5v8cV9V6QaXz1ORKKN9lrcQJPYxcmPLbNQ4A8 gba0rsbDXCAK/pX8gASlSZyd07wCZPFevYgADl8= X-Received: by 10.55.125.67 with SMTP id y64mr1902143qkc.84.1519164528652; Tue, 20 Feb 2018 14:08:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.198.17 with HTTP; Tue, 20 Feb 2018 14:08:48 -0800 (PST) In-Reply-To: <824bfc29-d6e8-9d7d-9307-79bf0097ce8e@iogearbox.net> References: <20180220211658.2653840-1-arnd@arndb.de> <824bfc29-d6e8-9d7d-9307-79bf0097ce8e@iogearbox.net> From: Arnd Bergmann Date: Tue, 20 Feb 2018 23:08:48 +0100 X-Google-Sender-Auth: uJDMlymk1Sbg9zW-2c3G-bj9Ws8 Message-ID: Subject: Re: [PATCH] bpf: hide a possibly unused variable To: Daniel Borkmann Cc: Alexei Starovoitov , "David S. Miller" , John Fastabend , Lawrence Brakmo , Jesper Dangaard Brouer , Jakub Kicinski , Networking , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 20, 2018 at 10:44 PM, Daniel Borkmann wrote: > Hi Arnd, > > On 02/20/2018 10:16 PM, Arnd Bergmann wrote: >> The only user of this variable is inside of an #ifdef, causing >> a warning without CONFIG_INET: >> >> net/core/filter.c: In function '____bpf_sock_ops_cb_flags_set': >> net/core/filter.c:3382:6: error: unused variable 'val' [-Werror=unused-variable] >> int val = argval & BPF_SOCK_OPS_ALL_CB_FLAGS; >> >> This adds the same #ifdef around the declaration. >> >> Fixes: b13d88072172 ("bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock") >> Signed-off-by: Arnd Bergmann >> --- >> net/core/filter.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/net/core/filter.c b/net/core/filter.c >> index 08ab4c65a998..c3dc6d60b4bb 100644 >> --- a/net/core/filter.c >> +++ b/net/core/filter.c >> @@ -3379,7 +3379,9 @@ BPF_CALL_2(bpf_sock_ops_cb_flags_set, struct bpf_sock_ops_kern *, bpf_sock, >> int, argval) >> { >> struct sock *sk = bpf_sock->sk; >> +#ifdef CONFIG_INET >> int val = argval & BPF_SOCK_OPS_ALL_CB_FLAGS; >> +#endif > > Looks good, thanks for the fix! > > Could you move the existing '#ifdef CONFIG_INET' to the beginning of > the function given the only error in case of !CONFIG_INET is -EINVAL > anyway? That would at least not increase the ifdef ugliness further. Sure, sent a new version now. I decided to clean up that #ifdef check as well, since a IS_ENABLED() check is nicer anway. Arnd