2006-01-19 02:12:12

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] kernel/kprobes.c: fix a warning #ifndef ARCH_SUPPORTS_KRETPROBES

This patch fixes the following warning #ifndef ARCH_SUPPORTS_KRETPROBES:

<-- snip -->

...
CC kernel/kprobes.o
kernel/kprobes.c:353: warning: 'pre_handler_kretprobe' defined but not used
...

<-- snip -->


Signed-off-by: Adrian Bunk <[email protected]>

---

This patch was already sent on:
- 14 Jan 2006

--- linux-2.6.15-mm4-sparc64/kernel/kprobes.c.old 2006-01-14 20:17:59.000000000 +0100
+++ linux-2.6.15-mm4-sparc64/kernel/kprobes.c 2006-01-14 20:19:03.000000000 +0100
@@ -344,23 +344,6 @@
spin_unlock_irqrestore(&kretprobe_lock, flags);
}

-/*
- * This kprobe pre_handler is registered with every kretprobe. When probe
- * hits it will set up the return probe.
- */
-static int __kprobes pre_handler_kretprobe(struct kprobe *p,
- struct pt_regs *regs)
-{
- struct kretprobe *rp = container_of(p, struct kretprobe, kp);
- unsigned long flags = 0;
-
- /*TODO: consider to only swap the RA after the last pre_handler fired */
- spin_lock_irqsave(&kretprobe_lock, flags);
- arch_prepare_kretprobe(rp, regs);
- spin_unlock_irqrestore(&kretprobe_lock, flags);
- return 0;
-}
-
static inline void free_rp_inst(struct kretprobe *rp)
{
struct kretprobe_instance *ri;
@@ -578,6 +561,23 @@

#ifdef ARCH_SUPPORTS_KRETPROBES

+/*
+ * This kprobe pre_handler is registered with every kretprobe. When probe
+ * hits it will set up the return probe.
+ */
+static int __kprobes pre_handler_kretprobe(struct kprobe *p,
+ struct pt_regs *regs)
+{
+ struct kretprobe *rp = container_of(p, struct kretprobe, kp);
+ unsigned long flags = 0;
+
+ /*TODO: consider to only swap the RA after the last pre_handler fired */
+ spin_lock_irqsave(&kretprobe_lock, flags);
+ arch_prepare_kretprobe(rp, regs);
+ spin_unlock_irqrestore(&kretprobe_lock, flags);
+ return 0;
+}
+
int __kprobes register_kretprobe(struct kretprobe *rp)
{
int ret = 0;


Subject: Re: [2.6 patch] kernel/kprobes.c: fix a warning #ifndef ARCH_SUPPORTS_KRETPROBES

On Thu, Jan 19, 2006 at 03:11:54AM +0100, Adrian Bunk wrote:
> This patch fixes the following warning #ifndef ARCH_SUPPORTS_KRETPROBES:
>
> <-- snip -->
>
> ...
> CC kernel/kprobes.o
> kernel/kprobes.c:353: warning: 'pre_handler_kretprobe' defined but not used
> ...
>
> <-- snip -->
>
>
> Signed-off-by: Adrian Bunk <[email protected]>
Acked-by: Ananth N Mavinakayanahalli <[email protected]>

Ananth
>
> ---
>
> This patch was already sent on:
> - 14 Jan 2006
>
> --- linux-2.6.15-mm4-sparc64/kernel/kprobes.c.old 2006-01-14 20:17:59.000000000 +0100
> +++ linux-2.6.15-mm4-sparc64/kernel/kprobes.c 2006-01-14 20:19:03.000000000 +0100
> @@ -344,23 +344,6 @@
> spin_unlock_irqrestore(&kretprobe_lock, flags);
> }
>
> -/*
> - * This kprobe pre_handler is registered with every kretprobe. When probe
> - * hits it will set up the return probe.
> - */
> -static int __kprobes pre_handler_kretprobe(struct kprobe *p,
> - struct pt_regs *regs)
> -{
> - struct kretprobe *rp = container_of(p, struct kretprobe, kp);
> - unsigned long flags = 0;
> -
> - /*TODO: consider to only swap the RA after the last pre_handler fired */
> - spin_lock_irqsave(&kretprobe_lock, flags);
> - arch_prepare_kretprobe(rp, regs);
> - spin_unlock_irqrestore(&kretprobe_lock, flags);
> - return 0;
> -}
> -
> static inline void free_rp_inst(struct kretprobe *rp)
> {
> struct kretprobe_instance *ri;
> @@ -578,6 +561,23 @@
>
> #ifdef ARCH_SUPPORTS_KRETPROBES
>
> +/*
> + * This kprobe pre_handler is registered with every kretprobe. When probe
> + * hits it will set up the return probe.
> + */
> +static int __kprobes pre_handler_kretprobe(struct kprobe *p,
> + struct pt_regs *regs)
> +{
> + struct kretprobe *rp = container_of(p, struct kretprobe, kp);
> + unsigned long flags = 0;
> +
> + /*TODO: consider to only swap the RA after the last pre_handler fired */
> + spin_lock_irqsave(&kretprobe_lock, flags);
> + arch_prepare_kretprobe(rp, regs);
> + spin_unlock_irqrestore(&kretprobe_lock, flags);
> + return 0;
> +}
> +
> int __kprobes register_kretprobe(struct kretprobe *rp)
> {
> int ret = 0;
>

2006-01-19 16:20:37

by Keshavamurthy, Anil S

[permalink] [raw]
Subject: RE: [2.6 patch] kernel/kprobes.c: fix a warning #ifndef ARCH_SUPPORTS_KRETPROBES

Andrew,
This patch looks good to me and Acking this patch, please apply.

-Anil Keshavamurthy

>From: Adrian Bunk [mailto:[email protected]]
>Sent: Wednesday, January 18, 2006 6:12 PM
>To: Andrew Morton
>Cc: [email protected]; [email protected]; Keshavamurthy,
>Anil S; [email protected]; [email protected]
>Subject: [2.6 patch] kernel/kprobes.c: fix a warning #ifndef
>ARCH_SUPPORTS_KRETPROBES
>
>This patch fixes the following warning #ifndef
>ARCH_SUPPORTS_KRETPROBES:
>
><-- snip -->
>
>...
> CC kernel/kprobes.o
>kernel/kprobes.c:353: warning: 'pre_handler_kretprobe' defined
>but not used
>...
>
><-- snip -->
>
>
>Signed-off-by: Adrian Bunk <[email protected]>

Acked-by: Anil S Keshavamurthy <[email protected]>

>
>---
>
>This patch was already sent on:
>- 14 Jan 2006