[PATCH 3/3] Assert notifier_block and notifier_call are not in init section



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/



Relevant Pages

  • Re: How to: referencing variables using the contents of otehr variables.
    ... the overhead would be less than the noise threshold. ... But with regards to enums in particular, That did go a little beyond ... I'll probably end up giving enums ... of my current data structure before I try a different one. ...
    (comp.lang.java.help)
  • Re: urgent ......problems on group
    ... would suggest you change your data structure such that all your data is ... > what I'm trying to do is to get total quantity group by ... > best regards ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Python Dict problems
    ... > any other similar data structure for the following purpose: ... by the reg-ex engine. ... regards Max M ...
    (comp.lang.python)
  • Re: Live Patching (Re: More static type fun.)
    ... Frode Vatvedt Fjeld wrote: ... >>e.g. when you replace a data structure by a completely different ... accessing an object that's in the midst of an incompatible change?" ... Regards, ...
    (comp.lang.lisp)