lkml.org 
[lkml]   [2020]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH bpf] bpf: fix unused-var without NETDEVICES
From
Date
Hi Ferenc,

On 03/06/2020 10:56, Ferenc Fejes wrote:
> Matthieu Baerts <matthieu.baerts@tessares.net> 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

\
 
 \ /
  Last update: 2020-06-03 11:12    [W:0.075 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site