Skip to contentSkip to conversation

kprobes: fix compiler warning

PATCH In review Dong Fang 1 participant 2 messages Jul 1, 2013 – Jul 14, 2013 kprobes

lore
Share & tools
lore

Dong Fang

author
#0 lore raw

PATCH v2 1/1 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

---
 kernel/kprobes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/kprobes.c +1 -1
index bddf3b2..7a5b2b1 100644
@@ -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 */
Signature · 1 line
1.7.1
author
#1 lore raw
Quoted 16 lines · Dong Fang

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

---
  kernel/kprobes.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
kernel/kprobes.c +0 -0
index bddf3b2..7a5b2b1 100644

kernel/kprobes.c int __kprobes register_kprobe(struct kprobe *p) · line 1496

Quoted 8 lines
kernel/kprobes.c +1 -1
@@ -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 */

can anybody take a look at this patch and give me some feedback? thx