Quantcast
Channel: lkml.org : Shesha Sreenivasamurthy
Viewing all articles
Browse latest Browse all 1267

Re: [PATCH v5 0/2] Remove false-positive VLAs when using max()

$
0
0
Linus Torvalds writes: (Summary) On Sat, Mar 17, 2018 at 1:07 PM, Kees Cook <keescook@chromium.org> So thanks to the diseased mind of Martin Uecker, there's a better test for "__is_constant()":
test for "__is_constant()":
  /* Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de> ((void*)((a) * 0l)) : (int*)1)))

that is actually *specified* by the C standard to work, and doesn't
even depend on any gcc extensions.

The reason is some really subtle pointer conversion rules, where the
type of the ternary operator will depend on whether one of the
pointers is NULL or not.

Viewing all articles
Browse latest Browse all 1267

Trending Articles