[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B7115@saturn3.aculab.com>
Date: Fri, 18 Jan 2013 10:00:53 -0000
From: "David Laight" <David.Laight@...LAB.COM>
To: "Mike Frysinger" <vapier@...too.org>,
<stephen.hemminger@...tta.com>, <netdev@...r.kernel.org>
Subject: RE: [PATCH v2] [iproute] ipxfrm: use alloca to allocate stack space
> Clang doesn't support the gcc extension for embeddeding flexible arrays
> inside of structures. Use the slightly more portable alloca().
>
> Signed-off-by: Mike Frysinger <vapier@...too.org>
> ---
> v2
> - use alloca rather than flexible arrays in structures
...
> +#include <alloca.h>
I'm not sure what happens in Linux, but alloca.h is likely
to try to use the libc version of alloca().
While that worked 20 years ago, these days compilers then
to use %sp relative addressing so you must only use the
compiler builtin alloca() code.
With gcc, compiling with -std=c89 (I think that is the one)
causes the builtin alloca() not to be defined.
By default alloca() is part of the language and the header
isn't needed.
Use of alloca() also stops some of the stack overwrite
protection being enabled.
In this case I suspect malloc() and free() is best.
(Or change the called function ...)
David
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists