param: silence .init.text references from param ops
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 12 Aug 2010 05:04:16 +0000 (23:04 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 11 Aug 2010 13:34:17 +0000 (23:04 +0930)
Ideally, we'd check that it was only the "set" function which was __init,
and that the permissions were r/o.  But that's a little hard.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Tested-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
scripts/mod/modpost.c

index 1ce655d..b160440 100644 (file)
@@ -1033,6 +1033,13 @@ static const struct sectioncheck *section_mismatch(
  *   fromsec = .data*
  *   atsym   =__param*
  *
+ * Pattern 1a:
+ *   module_param_call() ops can refer to __init set function if permissions=0
+ *   The pattern is identified by:
+ *   tosec   = .init.text
+ *   fromsec = .data*
+ *   atsym   = __param_ops_*
+ *
  * Pattern 2:
  *   Many drivers utilise a *driver container with references to
  *   add, remove, probe functions etc.
@@ -1067,6 +1074,12 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
            (strncmp(fromsym, "__param", strlen("__param")) == 0))
                return 0;
 
+       /* Check for pattern 1a */
+       if (strcmp(tosec, ".init.text") == 0 &&
+           match(fromsec, data_sections) &&
+           (strncmp(fromsym, "__param_ops_", strlen("__param_ops_")) == 0))
+               return 0;
+
        /* Check for pattern 2 */
        if (match(tosec, init_exit_sections) &&
            match(fromsec, data_sections) &&