2013-07-01 14:34:34

by remaper

[permalink] [raw]
Subject: [PATCH] kprobes: fix compiler warning

Fix the following compiler warning of uninitialized variable

kernel/kprobes.c: In function ‘register_kprobe’:
kernel/kprobes.c:1493: warning: ‘probed_mod’ may be used uninitialized in this function

Signed-off-by: Dong Fang <[email protected]>
---
kernel/kprobes.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index bddf3b2..7a5b2b1 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1490,7 +1490,7 @@ int __kprobes register_kprobe(struct kprobe *p)
{
int ret;
struct kprobe *old_p;
- struct module *probed_mod;
+ struct module *probed_mod = NULL;
kprobe_opcode_t *addr;

/* Adjust probe address from symbol */
--
1.7.1


2013-07-01 14:46:27

by remaper

[permalink] [raw]
Subject: Re: [PATCH] kprobes: fix compiler warning

On 07/01/2013 10:33 AM, Dong Fang wrote:
> Fix the following compiler warning of uninitialized variable
>
> kernel/kprobes.c: In function ‘register_kprobe’:
> kernel/kprobes.c:1493: warning: ‘probed_mod’ may be used uninitialized in this function
>
> Signed-off-by: Dong Fang <[email protected]>
> ---
> kernel/kprobes.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index bddf3b2..7a5b2b1 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1490,7 +1490,7 @@ int __kprobes register_kprobe(struct kprobe *p)
> {
> int ret;
> struct kprobe *old_p;
> - struct module *probed_mod;
> + struct module *probed_mod = NULL;
> kprobe_opcode_t *addr;
>
> /* Adjust probe address from symbol */
>
this patch seems have some problem, i will send a new patch later, thx