diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 16:26:45 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 16:26:45 -0400 |
| commit | 746bb4ed6d626f3f9e431a7f9b20504538e62ded (patch) | |
| tree | cc2f68bca54fb36ee8c72a29013e9c094a69935e /include/linux | |
| parent | ac747c0715f29c2be3848b719a1b7e65b07f7b21 (diff) | |
| parent | 0bb95f80a38f82884693194ea720e9cca5e12ada (diff) | |
Merge tag 'vla-v4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull VLA removal from Kees Cook:
"Globally warn on VLA use.
This turns on "-Wvla" globally now that the last few trees with their
VLA removals have landed (crypto, block, net, and powerpc).
Arnd mentioned that there may be a couple more VLAs hiding in
hard-to-find randconfigs, but nothing big has shaken out in the last
month or so in linux-next.
We should be basically VLA-free now! Wheee. :)
Summary:
- Remove unused fallback for BUILD_BUG_ON (which technically contains
a VLA)
- Lift -Wvla to the top-level Makefile"
* tag 'vla-v4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
Makefile: Globally enable VLA warning
compiler.h: give up __compiletime_assert_fallback()
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/compiler.h | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 1921545c6351..4170fcee5adb 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -344,29 +344,14 @@ static inline void *offset_to_ptr(const int *off) | |||
| 344 | #endif | 344 | #endif |
| 345 | #ifndef __compiletime_error | 345 | #ifndef __compiletime_error |
| 346 | # define __compiletime_error(message) | 346 | # define __compiletime_error(message) |
| 347 | /* | ||
| 348 | * Sparse complains of variable sized arrays due to the temporary variable in | ||
| 349 | * __compiletime_assert. Unfortunately we can't just expand it out to make | ||
| 350 | * sparse see a constant array size without breaking compiletime_assert on old | ||
| 351 | * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether. | ||
| 352 | */ | ||
| 353 | # ifndef __CHECKER__ | ||
| 354 | # define __compiletime_error_fallback(condition) \ | ||
| 355 | do { ((void)sizeof(char[1 - 2 * condition])); } while (0) | ||
| 356 | # endif | ||
| 357 | #endif | ||
| 358 | #ifndef __compiletime_error_fallback | ||
| 359 | # define __compiletime_error_fallback(condition) do { } while (0) | ||
| 360 | #endif | 347 | #endif |
| 361 | 348 | ||
| 362 | #ifdef __OPTIMIZE__ | 349 | #ifdef __OPTIMIZE__ |
| 363 | # define __compiletime_assert(condition, msg, prefix, suffix) \ | 350 | # define __compiletime_assert(condition, msg, prefix, suffix) \ |
| 364 | do { \ | 351 | do { \ |
| 365 | int __cond = !(condition); \ | ||
| 366 | extern void prefix ## suffix(void) __compiletime_error(msg); \ | 352 | extern void prefix ## suffix(void) __compiletime_error(msg); \ |
| 367 | if (__cond) \ | 353 | if (!(condition)) \ |
| 368 | prefix ## suffix(); \ | 354 | prefix ## suffix(); \ |
| 369 | __compiletime_error_fallback(__cond); \ | ||
| 370 | } while (0) | 355 | } while (0) |
| 371 | #else | 356 | #else |
| 372 | # define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0) | 357 | # define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0) |
