Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp718241ybg; Wed, 3 Jun 2020 11:43:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK7bekYnvCoR4lE9C6S1vL6Ug6zJ3Zfxhwp3v+PAMXOmUKU22mM/k5zQzd4lzzDkvg0rx/ X-Received: by 2002:a05:6402:1481:: with SMTP id e1mr755684edv.113.1591209817694; Wed, 03 Jun 2020 11:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591209817; cv=none; d=google.com; s=arc-20160816; b=qcnv5Arh2aJamCmOrWG4ixY15QhfxlqUIOnlk6re5m5eihD7acduok8l72QTtvWW6Z Ahd49oGh/S7NWmQoMBB0F3eSZUKXN3AHzb+rrB2srHYc+U84aFdSTjAeaJ1bWW6qDNoh VxgDNKMUEX3uNAv5lrVjpSfbGWB3ykXoW+scfP5wCAtA0Q85pqAdLFJUpLc/T7Za6lWo iN1HfNpPTqCH7xuUVAAd1d+RXW3/myBWO8bX0ge+0hFyvWxKGczAq7gg2afVGI5lfvc3 2u9NB1JfclWEcy1aGaK+8WnfQraCAMefcE7fCRDJa9YcgMoN1MxC6dUqv+zN+qpNKEJV MK2g== 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=S0TgVRaqXvLo/zqjh6Bua71lJw4suwzv026W+P/Naw8=; b=vp58O0O02H0mjQoLGuu/GISdaHLyqwxsOyEyKAZ1n4AQAX5NmF47sLwxek7SO/i7iw OvymqU4mZyO0Rty9CudYHJIDgNqXdvZOIyWM0XW5zORkzPtpxt5IerpQKsWZfmDjs+a2 e1Xz1LUh/e1pKhyWVZSyWxeomDk/kZaOe74XuUIyJNfhwr+v2N26uICU3QVC29hqjWaW m1wOBF2yl4bRFtpjaoI90DAETVt0LoEVYF9HLKBmGGfh12GvCL6CaC0iZQUCFP++9u1s uYUqjkzyCPODtOjkdy7LKL0bCjSw5h/RA7A2xzlrD0//T55NLb0bv5badRQFCcJQuYzl zinA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20150623.gappssmtp.com header.s=20150623 header.b=C0+b3DJ7; 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 ha25si246462ejb.180.2020.06.03.11.43.14; Wed, 03 Jun 2020 11:43:37 -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=C0+b3DJ7; 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 S1726135AbgFCSla (ORCPT + 99 others); Wed, 3 Jun 2020 14:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbgFCSl3 (ORCPT ); Wed, 3 Jun 2020 14:41:29 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 730A2C08C5C2 for ; Wed, 3 Jun 2020 11:41:29 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id e2so3235023eje.13 for ; Wed, 03 Jun 2020 11:41:29 -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=S0TgVRaqXvLo/zqjh6Bua71lJw4suwzv026W+P/Naw8=; b=C0+b3DJ7FfEDQKaieP18CwiGEkvjteY8TXKD0hCkYxGC6+7gm7AmFxZW15fIQkRLIM Kh5Jm7ok0fzu9poY7ZLIhZ58/u5sJAzW/bQRxIwpy3VQkbCpomTVIyqSRH154MdLzXX5 YK/+gOw8xoGKlM2oPEYWWp+ER6BVIWaY9o4JNWbYF9snmgSbjVOjxeEIbCRpEK+ieMsn dNHlym5awwcmUDb/tuJ5D309AkhWFct4ouZ0rQ28LCNE2tcZduzokMTHY+TUJim9+DBc fQj29FDGhJlHjJsvspR0d0qb+Sk70NpBKh87gEJiND8QB+0g8SxdDuGN/LadFwZH0YLO wpLg== 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=S0TgVRaqXvLo/zqjh6Bua71lJw4suwzv026W+P/Naw8=; b=FE7m3JGsSFRb8OBQE74MJOqTEZea3VG61RYZNS4rDYjW8o+TU2ABWrVdce1Ts2KNqD OkcXgN1RSbt6nFuFROU7YFJsSyR+u5w/AyBbskoI9PBT+qvM/hGcaJYlJtb0Tq154CZE BFQq8NPl3p+pWeVXCRKvOzlFctrNbXRbGAPayfbXBRxb31bf18dE8DwSJgxxD1k/idsL DXLQ1/FypX7H4eC3XlG0Zv5DZ1e+on53iEbP7cMsxbejO3+MLeZcrnNNBXun/tMu6V5p NzZjnLqgglLwZ9xqXNAoYKD5Nu2LVsfCvRdD7yXAX4ZJKmFSRGKLQH8kIT8yj0pjiPJ2 Dy7w== X-Gm-Message-State: AOAM53144wfOdYGzWbPmgtmSATitGIPDvRX/Kv39A5S2g+yutqq7d0RH TbRsd+ZQ72p5ZWA2yqjNzOc0FwhB3uvtYg== X-Received: by 2002:a17:907:2162:: with SMTP id rl2mr522768ejb.365.1591209687728; Wed, 03 Jun 2020 11:41:27 -0700 (PDT) Received: from tsr-lap-08.nix.tessares.net ([79.132.248.22]) by smtp.gmail.com with ESMTPSA id l18sm196629eds.46.2020.06.03.11.41.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Jun 2020 11:41:27 -0700 (PDT) Subject: Re: [PATCH bpf] bpf: fix unused-var without NETDEVICES To: Alexei Starovoitov Cc: Ferenc Fejes , 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> <1cb3266c-7c8c-ebe6-0b6e-6d970e0adbd1@tessares.net> <20200603181455.4sajgdyat7rkxxnf@ast-mbp.dhcp.thefacebook.com> From: Matthieu Baerts Message-ID: <3573c0dd-baa8-5313-067a-eec6b04f0f36@tessares.net> Date: Wed, 3 Jun 2020 20:41:25 +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: <20200603181455.4sajgdyat7rkxxnf@ast-mbp.dhcp.thefacebook.com> 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 Alexei, On 03/06/2020 20:14, Alexei Starovoitov wrote: > On Wed, Jun 03, 2020 at 11:12:01AM +0200, Matthieu Baerts wrote: >> 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 :) > > since CONFIG_NETDEVICES doesn't change anything in .h > I think the best is to remove #ifdef CONFIG_NETDEVICES from net/core/filter.c > and rely on sock_bindtoindex() returning ENOPROTOOPT > in the extreme case of oddly configured kernels. Good idea, thank you! I can send a patch implementing that. And sorry for the oddly configured kernels :) It's just used to test the compilation of the code related to MPTCP. 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