diff options
author | Huang Shijie <shijie.huang@arm.com> | 2016-08-03 16:46:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-08-04 08:50:07 -0400 |
commit | 57c24b2140437644f33eecdcc9c546bead0b5fbd (patch) | |
tree | 9fc61cc855332b3407292383422a2b8f7fefd167 | |
parent | 613413143faa3432e436674f1c2e57ad7d290ae1 (diff) |
samples/kretprobe: fix the wrong type
The regs_return_value() returns "unsigned long" or "long" value. But the
retval is int type now, it may cause overflow, the log may becomes:
[ 2911.078869] do_brk returned -2003877888 and took 4620 ns to execute
This patch converts the retval to "unsigned long" type, and fixes the
overflow issue.
Link: http://lkml.kernel.org/r/1464143083-3877-4-git-send-email-shijie.huang@arm.com
Signed-off-by: Huang Shijie <shijie.huang@arm.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Steve Capper <steve.capper@arm.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | samples/kprobes/kretprobe_example.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c index adc83e9f59d0..7f9060f435cd 100644 --- a/samples/kprobes/kretprobe_example.c +++ b/samples/kprobes/kretprobe_example.c | |||
@@ -55,14 +55,14 @@ static int entry_handler(struct kretprobe_instance *ri, struct pt_regs *regs) | |||
55 | */ | 55 | */ |
56 | static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) | 56 | static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) |
57 | { | 57 | { |
58 | int retval = regs_return_value(regs); | 58 | unsigned long retval = regs_return_value(regs); |
59 | struct my_data *data = (struct my_data *)ri->data; | 59 | struct my_data *data = (struct my_data *)ri->data; |
60 | s64 delta; | 60 | s64 delta; |
61 | ktime_t now; | 61 | ktime_t now; |
62 | 62 | ||
63 | now = ktime_get(); | 63 | now = ktime_get(); |
64 | delta = ktime_to_ns(ktime_sub(now, data->entry_stamp)); | 64 | delta = ktime_to_ns(ktime_sub(now, data->entry_stamp)); |
65 | pr_info("%s returned %d and took %lld ns to execute\n", | 65 | pr_info("%s returned %lu and took %lld ns to execute\n", |
66 | func_name, retval, (long long)delta); | 66 | func_name, retval, (long long)delta); |
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |