diff options
-rw-r--r-- | mm/kasan/kasan.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 6dc1aa7cefcc..def81104772f 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/memblock.h> | 22 | #include <linux/memblock.h> |
23 | #include <linux/memory.h> | ||
23 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
24 | #include <linux/printk.h> | 25 | #include <linux/printk.h> |
25 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
@@ -300,3 +301,23 @@ EXPORT_SYMBOL(__asan_storeN_noabort); | |||
300 | /* to shut up compiler complaints */ | 301 | /* to shut up compiler complaints */ |
301 | void __asan_handle_no_return(void) {} | 302 | void __asan_handle_no_return(void) {} |
302 | EXPORT_SYMBOL(__asan_handle_no_return); | 303 | EXPORT_SYMBOL(__asan_handle_no_return); |
304 | |||
305 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
306 | static int kasan_mem_notifier(struct notifier_block *nb, | ||
307 | unsigned long action, void *data) | ||
308 | { | ||
309 | return (action == MEM_GOING_ONLINE) ? NOTIFY_BAD : NOTIFY_OK; | ||
310 | } | ||
311 | |||
312 | static int __init kasan_memhotplug_init(void) | ||
313 | { | ||
314 | pr_err("WARNING: KASan doesn't support memory hot-add\n"); | ||
315 | pr_err("Memory hot-add will be disabled\n"); | ||
316 | |||
317 | hotplug_memory_notifier(kasan_mem_notifier, 0); | ||
318 | |||
319 | return 0; | ||
320 | } | ||
321 | |||
322 | module_init(kasan_memhotplug_init); | ||
323 | #endif | ||