Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1591303 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-03-02 18:20 +0100 |
| Last post | 2017-03-02 18:20 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 03/26] typecheck.h: avoid local variables in typecheck() macro Arnd Bergmann <arnd@arndb.de> - 2017-03-02 18:20 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-03-02 18:20 +0100 |
| Subject | [PATCH 03/26] typecheck.h: avoid local variables in typecheck() macro |
| Message-ID | <tgCyu-5uu-7@gated-at.bofh.it> |
With KASAN enabled, the typecheck macro leads to some serious stack memory,
as seen in the rt2xxx drivers:
drivers/net/wireless/ralink/rt2x00/rt2800lib.c: In function 'rt2800_init_registers':
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:5068:1: error: the frame size of 23768 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c: In function 'rt2800_config_txpower_rt3593.isra.1':
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:4126:1: error: the frame size of 14184 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
drivers/net/wireless/ralink/rt2x00/rt2800lib.c: In function 'rt2800_config_channel_rf3053.isra.5':
drivers/net/wireless/ralink/rt2x00/rt2800lib.c:2585:1: error: the frame size of 7632 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
If we express the macro in a way that avoids the local variables, this goes
away and the stacks are comparable to building without KASAN.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
include/linux/typecheck.h | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/include/linux/typecheck.h b/include/linux/typecheck.h
index eb5b74a575be..adb1579fa5f0 100644
--- a/include/linux/typecheck.h
+++ b/include/linux/typecheck.h
@@ -5,12 +5,7 @@
* Check at compile time that something is of a particular type.
* Always evaluates to 1 so you may use it easily in comparisons.
*/
-#define typecheck(type,x) \
-({ type __dummy; \
- typeof(x) __dummy2; \
- (void)(&__dummy == &__dummy2); \
- 1; \
-})
+#define typecheck(type,x) ({(void)((typeof(type) *)NULL == (typeof(x) *)NULL); 1;})
/*
* Check at compile time that 'function' is a certain type, or is a pointer
--
2.9.0
Back to top | Article view | linux.kernel
csiph-web