Commit a6de51b2787012ba3ab62c7d50df1b749b83d5f0

Authored by Rusty Russell
1 parent 4ef2db016a

param: don't deref arg in __same_type() checks

gcc allows this when arg is a function, but sparse complains:

drivers/char/ipmi/ipmi_watchdog.c:303:1: error: cannot dereference this type
drivers/char/ipmi/ipmi_watchdog.c:307:1: error: cannot dereference this type
drivers/char/ipmi/ipmi_watchdog.c:311:1: error: cannot dereference this type

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Tested-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Showing 1 changed file with 5 additions and 5 deletions Side-by-side Diff

include/linux/moduleparam.h
... ... @@ -125,7 +125,7 @@
125 125 */
126 126 #define module_param_cb(name, ops, arg, perm) \
127 127 __module_param_call(MODULE_PARAM_PREFIX, \
128   - name, ops, arg, __same_type(*(arg), bool), perm)
  128 + name, ops, arg, __same_type((arg), bool *), perm)
129 129  
130 130 /* On alpha, ia64 and ppc64 relocations to global data cannot go into
131 131 read-only sections (which is part of respective UNIX ABI on these
... ... @@ -157,7 +157,7 @@
157 157 { (void *)set, (void *)get }; \
158 158 __module_param_call(MODULE_PARAM_PREFIX, \
159 159 name, &__param_ops_##name, arg, \
160   - __same_type(*(arg), bool), \
  160 + __same_type(arg, bool *), \
161 161 (perm) + sizeof(__check_old_set_param(set))*0)
162 162  
163 163 /* We don't get oldget: it's often a new-style param_get_uint, etc. */
... ... @@ -330,9 +330,9 @@
330 330 #define param_check_bool(name, p) \
331 331 static inline void __check_##name(void) \
332 332 { \
333   - BUILD_BUG_ON(!__same_type(*(p), bool) && \
334   - !__same_type(*(p), unsigned int) && \
335   - !__same_type(*(p), int)); \
  333 + BUILD_BUG_ON(!__same_type((p), bool *) && \
  334 + !__same_type((p), unsigned int *) && \
  335 + !__same_type((p), int *)); \
336 336 }
337 337  
338 338 extern struct kernel_param_ops param_ops_invbool;