[PATCH 3/3] Assert notifier_block and notifier_call are not in init section
From: sekharan
Date: Mon Apr 24 2006 - 22:35:54 EST
Andrew,
Feel free to drop this patch if you think it is not needed.
regards,
chandra
--
This patch ASSERTS that the notifier_block data structure and the
notifier_call funtion are not in the init section.
--
Signed-Off-By: Chandra Seetharaman <sekharan@xxxxxxxxxx>
sys.c | 7 +++++++
1 files changed, 7 insertions(+)
Index: linux-2617-rc2/kernel/sys.c
===================================================================
--- linux-2617-rc2.orig/kernel/sys.c 2006-04-24 11:29:30.000000000 -0700
+++ linux-2617-rc2/kernel/sys.c 2006-04-24 11:36:35.000000000 -0700
@@ -97,6 +97,11 @@ int cad_pid = 1;
static BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
+static inline int addr_in_init_section(void *addr)
+{
+ return ((addr >= (void *)__init_begin) && (addr < (void *)__init_end));
+}
+
/*
* Notifier chain core routines. The exported routines below
* are layered on top of these, with appropriate locking added.
@@ -105,6 +110,8 @@ static BLOCKING_NOTIFIER_HEAD(reboot_not
static int notifier_chain_register(struct notifier_block **nl,
struct notifier_block *n)
{
+ BUG_ON(addr_in_init_section(n)
+ || addr_in_init_section(n->notifier_call));
while ((*nl) != NULL) {
if (n->priority > (*nl)->priority)
break;
--
----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- sekharan@xxxxxxxxxx | .......you may get it.
----------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/