Commit fd02e6f7ae085840d43d780149fcf95a614eca5e

Authored by Masami Hiramatsu
Committed by Ingo Molnar
1 parent 0f55a2f3d4

kprobes: Fix selftest to clear flags field for reusing probes

Fix selftest to clear flags field for reusing probes
because the flags field can be modified by Kprobes.
This also set NULL to kprobe.addr instead of 0.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: 2nddept-manager@sdl.hitachi.co.jp
LKML-Reference: <20101014031024.4100.50107.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 1 changed file with 9 additions and 3 deletions Side-by-side Diff

kernel/test_kprobes.c
... ... @@ -115,7 +115,9 @@
115 115 int ret;
116 116 struct kprobe *kps[2] = {&kp, &kp2};
117 117  
118   - kp.addr = 0; /* addr should be cleard for reusing kprobe. */
  118 + /* addr and flags should be cleard for reusing kprobe. */
  119 + kp.addr = NULL;
  120 + kp.flags = 0;
119 121 ret = register_kprobes(kps, 2);
120 122 if (ret < 0) {
121 123 printk(KERN_ERR "Kprobe smoke test failed: "
... ... @@ -210,7 +212,9 @@
210 212 int ret;
211 213 struct jprobe *jps[2] = {&jp, &jp2};
212 214  
213   - jp.kp.addr = 0; /* addr should be cleard for reusing kprobe. */
  215 + /* addr and flags should be cleard for reusing kprobe. */
  216 + jp.kp.addr = NULL;
  217 + jp.kp.flags = 0;
214 218 ret = register_jprobes(jps, 2);
215 219 if (ret < 0) {
216 220 printk(KERN_ERR "Kprobe smoke test failed: "
... ... @@ -323,7 +327,9 @@
323 327 int ret;
324 328 struct kretprobe *rps[2] = {&rp, &rp2};
325 329  
326   - rp.kp.addr = 0; /* addr should be cleard for reusing kprobe. */
  330 + /* addr and flags should be cleard for reusing kprobe. */
  331 + rp.kp.addr = NULL;
  332 + rp.kp.flags = 0;
327 333 ret = register_kretprobes(rps, 2);
328 334 if (ret < 0) {
329 335 printk(KERN_ERR "Kprobe smoke test failed: "