Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp344419ybg; Wed, 3 Jun 2020 02:14:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2FAjfPkr/AbS+MqkscwvcqpnbD35mPC0t3aYolQp3q/TZ3teeLsMyl8TLhWQlJiDLwn05 X-Received: by 2002:aa7:d806:: with SMTP id v6mr29540933edq.174.1591175672516; Wed, 03 Jun 2020 02:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591175672; cv=none; d=google.com; s=arc-20160816; b=QjJSEJGtHx+3xnVYLXVyuRa6qWtNruLft47xfe9vFbKCqQpBqc3n0n2Uk4xcpdS8rc p9e31WWdp9X3szbhv9ez85XRj+Kz0LuL8dLJ3EvXyiCc3j2JOPFMMr4eMLvfMQmo6id1 e+wewQC5l+O7OxatJATJ9f+6VXTdKjPrTuD4MYwLD5CRjKnaQTRDDm9oP3RKtUfdwKCc 2pSUbvde4exmu+f4cxOCg9dzKh2POHVkBD+CcDobsKenE/qlmTNY/deUocqejx6CMtjk rC/dfuVnQRKwr02/nKc9CPosFjkvK8Pvudh63N8906jrGhdETReEaNcecz0Lo+kIzjEY GA9Q== 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:dkim-signature; bh=nTJKg7NFlS/kS/+rvsgLEsS0PyK1+J6045eIfGo40yo=; b=Mg2IdAA4gsDNBS6SRPbxXtWi7qWsw8vCbUuffS+8WEjJqgSB9VX87tDL1B6Ksbmkwj davFUoiN9ov7dbf0YhXjH+mdIkWu0VpsunPEExQtqw8ZveqKke3WsMdvQ9AKgtgWdbpz ZThwqsjK+lUXTrotNc8hp3vARfkTpRVH4m3xlYN4dFN0JLzhRW9dI21wmCuACtve8B8+ yGWcpBnUdvPFTgs0p2QH1jH5e50IUxRyyh9OciLvopLZqFghWVfXMw7Gugt2i+JWK0bF 2OhUVA5v0tCm9Nhbnd4apQqI+881px8hiG96737tV0aKe4JOVBobNWlFLGB9AK2HZVhA dUGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20150623.gappssmtp.com header.s=20150623 header.b=D4oYPOKO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si742165edr.522.2020.06.03.02.14.09; Wed, 03 Jun 2020 02:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20150623.gappssmtp.com header.s=20150623 header.b=D4oYPOKO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbgFCJMF (ORCPT + 99 others); Wed, 3 Jun 2020 05:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbgFCJMF (ORCPT ); Wed, 3 Jun 2020 05:12:05 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B6FC03E96E for ; Wed, 3 Jun 2020 02:12:05 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id gl26so1348772ejb.11 for ; Wed, 03 Jun 2020 02:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares-net.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nTJKg7NFlS/kS/+rvsgLEsS0PyK1+J6045eIfGo40yo=; b=D4oYPOKO9hTNajgIR15Wn+4k++eP7IRGRfB9Mdcs4CqYquTmsDLhyZwWHShZO4LQlO ARASZr0P7WffkVXLMcy5tTs4hD8C1iBppLHnIISE1f7f5T1Co90qv0WXIyWbP1QSP0FW vvWk3EIt4TlqN5RZpd1AiIFnPFWqDY/hEyoLaDx+oj7ZD9JWMiFAHxkpNbjg6kBfrG0H ZWyf04x7R1Zr57A9Vb6i6St4/5YwC0jV7UKpJOidW5MMOPKCmKdFg5rYiJJrLGVIIwWw TtDwZVO06ZBNE/CSmzHfB/+bAID/X+W7iGHJKeIJBmNq18Uy0m7vwAa2OcxBJlqOktCx X28g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nTJKg7NFlS/kS/+rvsgLEsS0PyK1+J6045eIfGo40yo=; b=rHXe5ke7VgaIMaPJknQmq5lq0GgLphFRlEf7BQwJGz9rqY9P1kO9rDzlJPfUHN00t/ +3ZJXC9ge9+IP8UeSYYA6rm6lG0hKR6lZr7VfRmTkP/5CQDTpum/u9nbwazBfZglyGbV eSXeIXUNHtLoYj053P1oEYKIa5M+t6SnXML2XTAwUTz+DUX6k8r3Kpo3bEiF4GaFrh6Y eovTO/WUN4omAiGSmq5l2BLMbjCxXdCdU8eNxgJ/Haus97Uk0N5PmTtLtz9DGk63E2r+ V/IX/UbO0AQVr86aGokdUv/+RIu+0EsEoailWE3vhpwFSRfc89/XegzVIxTvHdPSV5kr 8wCg== X-Gm-Message-State: AOAM530OSqGXByUVR6CWqebeMCS0NA6Pv6m4TDx00aAsPWzYTXtn4N7h jPwUc4B2QBvcWmPtN8Q+47RnYIffqz6BHw== X-Received: by 2002:a17:906:f8f:: with SMTP id q15mr28143238ejj.389.1591175523317; Wed, 03 Jun 2020 02:12:03 -0700 (PDT) Received: from tsr-lap-08.nix.tessares.net ([79.132.248.22]) by smtp.gmail.com with ESMTPSA id dj26sm857510edb.4.2020.06.03.02.12.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Jun 2020 02:12:02 -0700 (PDT) Subject: Re: [PATCH bpf] bpf: fix unused-var without NETDEVICES To: Ferenc Fejes Cc: netdev@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , John Fastabend , KP Singh , "David S. Miller" , Jakub Kicinski , bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200603081124.1627600-1-matthieu.baerts@tessares.net> From: Matthieu Baerts Message-ID: <1cb3266c-7c8c-ebe6-0b6e-6d970e0adbd1@tessares.net> Date: Wed, 3 Jun 2020 11:12:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ferenc, On 03/06/2020 10:56, Ferenc Fejes wrote: > Matthieu Baerts ezt írta (időpont: > 2020. jún. 3., Sze, 10:11): >> >> A recent commit added new variables only used if CONFIG_NETDEVICES is >> set. > > Thank you for noticing and fixed this! > >> A simple fix is to only declare these variables if the same >> condition is valid. >> >> Other solutions could be to move the code related to SO_BINDTODEVICE >> option from _bpf_setsockopt() function to a dedicated one or only >> declare these variables in the related "case" section. > > Yes thats indeed a cleaner way to approach this. I will prepare a fix for that. I should have maybe added that I didn't take this approach because in the rest of the code, I don't see that variables are declared only in a "case" section (no "{" ... "}" after "case") and code is generally not moved into a dedicated function in these big switch/cases. But maybe it makes sense here because of the #ifdef! At the end, I took the simple approach because it is for -net. In other words, I don't know what maintainers would prefer here but I am happy to see any another solutions implemented to remove these compiler warnings :) Cheers, Matt -- Matthieu Baerts | R&D Engineer matthieu.baerts@tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium