[PATCH] bpf: remove dependency on vla

Stephen Hemminger stephen at networkplumber.org
Fri Aug 15 18:03:16 CEST 2025


On Fri, 15 Aug 2025 14:26:07 +0000
Konstantin Ananyev <konstantin.ananyev at huawei.com> wrote:

> > The code for ethdev callbacks was using variable length arrays
> > which is a feature not supported on MSVC and later C standards.
> > Replace with alloca().  
> 
> I am not a big fun of such mechanical replacement of vla with alloca()
> Specially in that particular case, we can have internal function that uses
> fixed size array and in public one just call it several times in a loop.
> Again, using VLA here is probably a real security breach,
> as we put some assumptions on size of input arrays provided by user,
> which we probably shouldn't.    
> 
> > Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>

The other way to handle this is to break the loop into chunks.
But it ends up being more awkward to read, and more complex.


More information about the dev mailing list