Received: by 10.223.185.116 with SMTP id b49csp1140923wrg; Tue, 20 Feb 2018 14:09:32 -0800 (PST) X-Google-Smtp-Source: AH8x224V3Q/CRyk3TnoeFo/XFVW8RXcao6ixD2Sm9RLliqX7lt/Te7s1qxyhQSC+IlF80TAzeDfx X-Received: by 10.98.199.9 with SMTP id w9mr1028334pfg.97.1519164572174; Tue, 20 Feb 2018 14:09:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519164572; cv=none; d=google.com; s=arc-20160816; b=boFAVEzRbkow+RxbTtH3ytF8eLqvxDNVbrbPQUG3fBxipWFBF1fQz0QzNobzc6mum7 tqasvBKC5yk2hhhs42DDqsSRV+i4Bix4EyqFjK5fOt7RJpMEacqm+JRp1sICpo/EkUvV NmCFsJ5wYeIja1SlZAymlH+Tw+Z2DvTau9fM2r4liIieygFI9fuBwwRMv3nEz5yyaAMQ +fyt5kFnxoYq+sC5NI611p2uF01aFE2+07Ug0uKfl4nMhFZVz8/MitZJP2xLyQv6n/5e Tz8ATIwDIhQWHkhVxaYDlXqGKUnrrathDfSbHaSIpoCa+NiGifDSPeCEd2Isfj4PaxHy +0sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ON8rRcovZX99CA/qvv2baMDDrLMKZqKH+VYqgAzyWjI=; b=WEcb8fBLODeChIY8fT5JyRv4tqfYofjEV+ZgwwP87ZHeAgNqLSP8AtqDNAgXLVsnhe 24FB+HviLvs/HSmQyScbvne95v+3uNJLp8UYNzFcFDiOf1tCOqSZYRGHW5eq55xIHMYO 7+74F/BaL1xc3SMiVweWC1K1RPPKNJMnM4aIHrkLBGfT2QbiREm6HN1mxoZBscGwmqyq sqz+MhWjaZze7D+pIT2trcZ/X7aUXSyGwoWy4ic56slAalGtLRzBG2aj51z0qv/hjQco esptEl1i54J0jjGOTBZgaVqM872fj/MYn4V0ptHCkbMfOgi4VmCsSPH2+j5P8hMw9Mh2 r6Cw== 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 f5si1716968pgo.320.2018.02.20.14.09.14; Tue, 20 Feb 2018 14:09:32 -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 S1751300AbeBTWI3 (ORCPT + 99 others); Tue, 20 Feb 2018 17:08:29 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:52417 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbeBTWI1 (ORCPT ); Tue, 20 Feb 2018 17:08:27 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MVEI1-1fG6cI3L9J-00YTeA; Tue, 20 Feb 2018 23:07:47 +0100 From: Arnd Bergmann To: Alexei Starovoitov , Daniel Borkmann Cc: Arnd Bergmann , "David S. Miller" , John Fastabend , Lawrence Brakmo , Jesper Dangaard Brouer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] bpf: clean up unused-variable warning Date: Tue, 20 Feb 2018 23:07:33 +0100 Message-Id: <20180220220744.305712-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:4lJxEsaYhNarphn7G2JDhV7A/lwM9+CZHf/GHQ+ofBeUnPTUzEw NuyrWsW/5I5Vvncjsww9QGK3exb+qlhmoo37Q33+XRK3stxwKK22a/uW2P/tfu6Ni3TOwv2 b4hRJWwA8EUcazsrdl8k2hbqS2aIora4TmzjtFwbYz+h3odExAaHSJbosMK9KkJOVUp9K1Z qAjSoQYU5mVztMi5ZH/JA== X-UI-Out-Filterresults: notjunk:1;V01:K0:PTeBjZDHzvM=:YDA1EXm6GRUtn2xEd12NQf HD8kS/ZepYiU/3QZP4vclgD1boz/xdpRjDy+masJrbU/2mWqgtFhsR8N7zgWEE9TGGA4x4pW5 XuiJRqUW7TNelBJX3YqjxkMrQYlDD9WQ3PrYPgIcxH3ylAyVoh369UG713pqSzgmT4q7z+iZd Sxr0MHZm/iWNYisjmPKYaBhbyCgkmwvqdhdsoY3PvHdaYAp7ABKI54GqgdC+HhQBw/tUi9JOt 8uydqVBea3W4lYuyOcV+hLg0lSiu1eN1q6YH9tBzNl9HRT+1J1/YCAJJqxl7dM0Tu0Gwzr27H oilruRb1bYYmN6dRJP79s+b5CxVrBQcqiRNtXPvcjbu52owPVIRK6tS0KFBhMZZcwG0yvFFiR ixU7PraoUCrLP4IV74pgKSevX2VJB4N32SyW+JdriNI5XH8CqalHQndi2kJvX0sSt/mhDdsVo yxgwUewwjZzpJs44wEiLiRNFjylQbu0N6GQzcmd2uhMx2Wd9XF9xhzL3KYGHHiBs8EMHyhnnr UjJs9iEwBaQaF10R2WKiElZXEPvYU4L19G2PTKBZ07KuMJ3j2oUIRz47AgCmPvlcZ0jILgPK8 9CB9hraC4cg7uEmUl8x8HjncK+rSXzqerTXEQaKQoEXWgbucG5meaBdq6TOch9g33ITDap3ad I0NOR6dqBnbfbTkPtUy9yHmrhbgEcjzLDOLtZSOOu7vjQVH+ig1GHRQLdp6xyQj6rgqO/di06 Ac/ptX3FPH8KcVa0RI0RlSQJiz2KbiIX4gs2YQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 replaces the #ifdef with a nicer IS_ENABLED() check that makes the code more readable and avoids the warning. Fixes: b13d88072172 ("bpf: Adds field bpf_sock_ops_cb_flags to tcp_sock") Signed-off-by: Arnd Bergmann --- net/core/filter.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/core/filter.c b/net/core/filter.c index 08ab4c65a998..0c121adbdbaa 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -3381,17 +3381,13 @@ BPF_CALL_2(bpf_sock_ops_cb_flags_set, struct bpf_sock_ops_kern *, bpf_sock, struct sock *sk = bpf_sock->sk; int val = argval & BPF_SOCK_OPS_ALL_CB_FLAGS; - if (!sk_fullsock(sk)) + if (!IS_ENABLED(CONFIG_INET) || !sk_fullsock(sk)) return -EINVAL; -#ifdef CONFIG_INET if (val) tcp_sk(sk)->bpf_sock_ops_cb_flags = val; return argval & (~BPF_SOCK_OPS_ALL_CB_FLAGS); -#else - return -EINVAL; -#endif } static const struct bpf_func_proto bpf_sock_ops_cb_flags_set_proto = { -- 2.9.0