Commit 0d098a7d authored by Rakib Mullick's avatar Rakib Mullick Committed by Steven Rostedt

x86/ftrace: Fix compiler warning in ftrace.c

 Due to commit dc326fca (x86, cpu: Clean up and unify the NOP selection infrastructure), we get the following warning:

arch/x86/kernel/ftrace.c: In function ‘ftrace_make_nop’:
arch/x86/kernel/ftrace.c:308:6: warning: assignment discards qualifiers from pointer target type
arch/x86/kernel/ftrace.c: In function ‘ftrace_make_call’:
arch/x86/kernel/ftrace.c:318:6: warning: assignment discards qualifiers from pointer target type

ftrace_nop_replace() now returns const unsigned char *, so change its associated function/variable to its compatible type to keep compiler clam.
Signed-off-by: default avatarRakib Mullick <rakib.mullick@gmail.com>
Link: http://lkml.kernel.org/r/1305221620.7986.4.camel@localhost.localdomain

[ updated for change of const void *src in probe_kernel_write() ]
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent f29c5041
...@@ -123,7 +123,7 @@ static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) ...@@ -123,7 +123,7 @@ static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
static atomic_t nmi_running = ATOMIC_INIT(0); static atomic_t nmi_running = ATOMIC_INIT(0);
static int mod_code_status; /* holds return value of text write */ static int mod_code_status; /* holds return value of text write */
static void *mod_code_ip; /* holds the IP to write to */ static void *mod_code_ip; /* holds the IP to write to */
static void *mod_code_newcode; /* holds the text to write to the IP */ static const void *mod_code_newcode; /* holds the text to write to the IP */
static unsigned nmi_wait_count; static unsigned nmi_wait_count;
static atomic_t nmi_update_count = ATOMIC_INIT(0); static atomic_t nmi_update_count = ATOMIC_INIT(0);
...@@ -225,7 +225,7 @@ within(unsigned long addr, unsigned long start, unsigned long end) ...@@ -225,7 +225,7 @@ within(unsigned long addr, unsigned long start, unsigned long end)
} }
static int static int
do_ftrace_mod_code(unsigned long ip, void *new_code) do_ftrace_mod_code(unsigned long ip, const void *new_code)
{ {
/* /*
* On x86_64, kernel text mappings are mapped read-only with * On x86_64, kernel text mappings are mapped read-only with
...@@ -266,8 +266,8 @@ static const unsigned char *ftrace_nop_replace(void) ...@@ -266,8 +266,8 @@ static const unsigned char *ftrace_nop_replace(void)
} }
static int static int
ftrace_modify_code(unsigned long ip, unsigned char *old_code, ftrace_modify_code(unsigned long ip, unsigned const char *old_code,
unsigned char *new_code) unsigned const char *new_code)
{ {
unsigned char replaced[MCOUNT_INSN_SIZE]; unsigned char replaced[MCOUNT_INSN_SIZE];
...@@ -301,7 +301,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code, ...@@ -301,7 +301,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
int ftrace_make_nop(struct module *mod, int ftrace_make_nop(struct module *mod,
struct dyn_ftrace *rec, unsigned long addr) struct dyn_ftrace *rec, unsigned long addr)
{ {
unsigned char *new, *old; unsigned const char *new, *old;
unsigned long ip = rec->ip; unsigned long ip = rec->ip;
old = ftrace_call_replace(ip, addr); old = ftrace_call_replace(ip, addr);
...@@ -312,7 +312,7 @@ int ftrace_make_nop(struct module *mod, ...@@ -312,7 +312,7 @@ int ftrace_make_nop(struct module *mod,
int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
{ {
unsigned char *new, *old; unsigned const char *new, *old;
unsigned long ip = rec->ip; unsigned long ip = rec->ip;
old = ftrace_nop_replace(); old = ftrace_nop_replace();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment