Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
On Wed, Mar 7, 2018 at 4:03 PM, Andrew Morton wrote: > On Wed, 7 Mar 2018 15:59:27 -0800 Kees Cook wrote: > >> I didn't want to encourage a global macro that _lacked_ the safety >> built into the max*() family, though... thoughts for a reasonable

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
On Wed, Mar 7, 2018 at 4:03 PM, Andrew Morton wrote: > On Wed, 7 Mar 2018 15:59:27 -0800 Kees Cook wrote: > >> I didn't want to encourage a global macro that _lacked_ the safety >> built into the max*() family, though... thoughts for a reasonable >> approach? > > I think SIMPLE_MAX() is OK.

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Andrew Morton
On Wed, 7 Mar 2018 15:59:27 -0800 Kees Cook wrote: > I didn't want to encourage a global macro that _lacked_ the safety > built into the max*() family, though... thoughts for a reasonable > approach? I think SIMPLE_MAX() is OK.Along with one of /* these */ things ;)

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Andrew Morton
On Wed, 7 Mar 2018 15:59:27 -0800 Kees Cook wrote: > I didn't want to encourage a global macro that _lacked_ the safety > built into the max*() family, though... thoughts for a reasonable > approach? I think SIMPLE_MAX() is OK.Along with one of /* these */ things ;)

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
On Wed, Mar 7, 2018 at 3:42 PM, Tycho Andersen wrote: > Hi Kees, > > On Wed, Mar 07, 2018 at 03:07:14PM -0800, Kees Cook wrote: >> The "sym" calculation is actually a fixed size, but since the max() >> macro uses some extensive tricks for safety, it ends up looking like a >>

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
On Wed, Mar 7, 2018 at 3:42 PM, Tycho Andersen wrote: > Hi Kees, > > On Wed, Mar 07, 2018 at 03:07:14PM -0800, Kees Cook wrote: >> The "sym" calculation is actually a fixed size, but since the max() >> macro uses some extensive tricks for safety, it ends up looking like a >> variable size. This

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
On Wed, Mar 7, 2018 at 3:40 PM, Andrew Morton wrote: > On Wed, 7 Mar 2018 15:07:14 -0800 Kees Cook wrote: > >> The "sym" calculation is actually a fixed size, but since the max() >> macro uses some extensive tricks for safety, it ends up looking

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
On Wed, Mar 7, 2018 at 3:40 PM, Andrew Morton wrote: > On Wed, 7 Mar 2018 15:07:14 -0800 Kees Cook wrote: > >> The "sym" calculation is actually a fixed size, but since the max() >> macro uses some extensive tricks for safety, it ends up looking like a >> variable size. This replaces max() with

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Tycho Andersen
Hi Kees, On Wed, Mar 07, 2018 at 03:07:14PM -0800, Kees Cook wrote: > The "sym" calculation is actually a fixed size, but since the max() > macro uses some extensive tricks for safety, it ends up looking like a > variable size. This replaces max() with a simple max macro which is > sufficient for

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Tycho Andersen
Hi Kees, On Wed, Mar 07, 2018 at 03:07:14PM -0800, Kees Cook wrote: > The "sym" calculation is actually a fixed size, but since the max() > macro uses some extensive tricks for safety, it ends up looking like a > variable size. This replaces max() with a simple max macro which is > sufficient for

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Andrew Morton
On Wed, 7 Mar 2018 15:07:14 -0800 Kees Cook wrote: > The "sym" calculation is actually a fixed size, but since the max() > macro uses some extensive tricks for safety, it ends up looking like a > variable size. This replaces max() with a simple max macro which is >

Re: [PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Andrew Morton
On Wed, 7 Mar 2018 15:07:14 -0800 Kees Cook wrote: > The "sym" calculation is actually a fixed size, but since the max() > macro uses some extensive tricks for safety, it ends up looking like a > variable size. This replaces max() with a simple max macro which is > sufficient for the calculation

[PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
The "sym" calculation is actually a fixed size, but since the max() macro uses some extensive tricks for safety, it ends up looking like a variable size. This replaces max() with a simple max macro which is sufficient for the calculation of the array size. Seen with -Wvla. Fixed as part of the

[PATCH] vsprintf: Remove accidental VLA usage

2018-03-07 Thread Kees Cook
The "sym" calculation is actually a fixed size, but since the max() macro uses some extensive tricks for safety, it ends up looking like a variable size. This replaces max() with a simple max macro which is sufficient for the calculation of the array size. Seen with -Wvla. Fixed as part of the