From: Huang Shijie Date: Wed, 3 Aug 2016 20:46:12 +0000 (-0700) Subject: samples/kretprobe: fix the wrong type X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=57c24b2140437644f33eecdcc9c546bead0b5fbd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Petr Mladek Cc: Steve Capper Cc: Ananth N Mavinakayanahalli Cc: Anil S Keshavamurthy Cc: Masami Hiramatsu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) */ static int ret_handler(struct kretprobe_instance *ri, struct pt_regs *regs) { - int retval = regs_return_value(regs); + unsigned long retval = regs_return_value(regs); struct my_data *data = (struct my_data *)ri->data; s64 delta; ktime_t now; now = ktime_get(); delta = ktime_to_ns(ktime_sub(now, data->entry_stamp)); - pr_info("%s returned %d and took %lld ns to execute\n", + pr_info("%s returned %lu and took %lld ns to execute\n", func_name, retval, (long long)delta); return 0; }