diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2008-02-08 07:18:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:24 -0500 |
commit | 92dfc9dc7ba63134f721b6e745dbdcfc13ea341b (patch) | |
tree | aa959d2d5ba1819651888601e4d917b01ddcc88c | |
parent | 6d7623943c905efae327933bc5ee0b2f78e15f56 (diff) |
fix "modules: make module_address_lookup() safe"
Get the constness right, avoid nasty cast.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/module.h | 4 | ||||
-rw-r--r-- | kernel/module.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index ac481e2094fd..ac28e8761e84 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -449,7 +449,7 @@ static inline void __module_get(struct module *module) | |||
449 | /* For kallsyms to ask for address resolution. namebuf should be at | 449 | /* For kallsyms to ask for address resolution. namebuf should be at |
450 | * least KSYM_NAME_LEN long: a pointer to namebuf is returned if | 450 | * least KSYM_NAME_LEN long: a pointer to namebuf is returned if |
451 | * found, otherwise NULL. */ | 451 | * found, otherwise NULL. */ |
452 | char *module_address_lookup(unsigned long addr, | 452 | const char *module_address_lookup(unsigned long addr, |
453 | unsigned long *symbolsize, | 453 | unsigned long *symbolsize, |
454 | unsigned long *offset, | 454 | unsigned long *offset, |
455 | char **modname, | 455 | char **modname, |
@@ -519,7 +519,7 @@ static inline void module_put(struct module *module) | |||
519 | #define module_name(mod) "kernel" | 519 | #define module_name(mod) "kernel" |
520 | 520 | ||
521 | /* For kallsyms to ask for address resolution. NULL means not found. */ | 521 | /* For kallsyms to ask for address resolution. NULL means not found. */ |
522 | static inline char *module_address_lookup(unsigned long addr, | 522 | static inline const char *module_address_lookup(unsigned long addr, |
523 | unsigned long *symbolsize, | 523 | unsigned long *symbolsize, |
524 | unsigned long *offset, | 524 | unsigned long *offset, |
525 | char **modname, | 525 | char **modname, |
diff --git a/kernel/module.c b/kernel/module.c index 676c023c831b..4202da97a1da 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2253,7 +2253,7 @@ static const char *get_ksymbol(struct module *mod, | |||
2253 | 2253 | ||
2254 | /* For kallsyms to ask for address resolution. NULL means not found. Careful | 2254 | /* For kallsyms to ask for address resolution. NULL means not found. Careful |
2255 | * not to lock to avoid deadlock on oopses, simply disable preemption. */ | 2255 | * not to lock to avoid deadlock on oopses, simply disable preemption. */ |
2256 | char *module_address_lookup(unsigned long addr, | 2256 | const char *module_address_lookup(unsigned long addr, |
2257 | unsigned long *size, | 2257 | unsigned long *size, |
2258 | unsigned long *offset, | 2258 | unsigned long *offset, |
2259 | char **modname, | 2259 | char **modname, |
@@ -2278,7 +2278,7 @@ char *module_address_lookup(unsigned long addr, | |||
2278 | ret = namebuf; | 2278 | ret = namebuf; |
2279 | } | 2279 | } |
2280 | preempt_enable(); | 2280 | preempt_enable(); |
2281 | return (char *)ret; | 2281 | return ret; |
2282 | } | 2282 | } |
2283 | 2283 | ||
2284 | int lookup_module_symbol_name(unsigned long addr, char *symname) | 2284 | int lookup_module_symbol_name(unsigned long addr, char *symname) |