@@ -840,18 +840,22 @@ void init_mem_debugging_and_hardening(vo
}
#endif
- if (_init_on_alloc_enabled_early) {
- if (page_poisoning_requested)
+ if (_init_on_alloc_enabled_early ||
+ IS_ENABLED(CONFIG_INIT_ON_ALLOC_DEFAULT_ON)) {
+ if (page_poisoning_requested) {
pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, "
"will take precedence over init_on_alloc\n");
- else
+ static_branch_disable(&init_on_alloc);
+ } else
static_branch_enable(&init_on_alloc);
}
- if (_init_on_free_enabled_early) {
- if (page_poisoning_requested)
+ if (_init_on_free_enabled_early ||
+ IS_ENABLED(CONFIG_INIT_ON_FREE_DEFAULT_ON)) {
+ if (page_poisoning_requested) {
pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, "
"will take precedence over init_on_free\n");
- else
+ static_branch_disable(&init_on_free);
+ } else
static_branch_enable(&init_on_free);
}