Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 126338
b: refs/heads/master
c: 8e11440
h: refs/heads/master
v: v3
  • Loading branch information
Masami Hiramatsu authored and Linus Torvalds committed Jan 6, 2009
1 parent be6084c commit 6152208
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bc2f70151fe7a117dbe8347edc5a877e749572a3
refs/heads/master: 8e1144050e49dd4ef19c117dc5626f212cfe73cf
21 changes: 6 additions & 15 deletions trunk/kernel/test_kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,10 @@

static u32 rand1, preh_val, posth_val, jph_val;
static int errors, handler_errors, num_tests;
static u32 (*target)(u32 value);

static noinline u32 kprobe_target(u32 value)
{
/*
* gcc ignores noinline on some architectures unless we stuff
* sufficient lard into the function. The get_kprobe() here is
* just for that.
*
* NOTE: We aren't concerned about the correctness of get_kprobe()
* here; hence, this call is neither under !preempt nor with the
* kprobe_mutex held. This is fine(tm)
*/
if (get_kprobe((void *)0xdeadbeef))
printk(KERN_INFO "Kprobe smoke test: probe on 0xdeadbeef!\n");

return (value / div_factor);
}

Expand Down Expand Up @@ -74,7 +63,7 @@ static int test_kprobe(void)
return ret;
}

ret = kprobe_target(rand1);
ret = target(rand1);
unregister_kprobe(&kp);

if (preh_val == 0) {
Expand Down Expand Up @@ -121,7 +110,7 @@ static int test_jprobe(void)
return ret;
}

ret = kprobe_target(rand1);
ret = target(rand1);
unregister_jprobe(&jp);
if (jph_val == 0) {
printk(KERN_ERR "Kprobe smoke test failed: "
Expand Down Expand Up @@ -177,7 +166,7 @@ static int test_kretprobe(void)
return ret;
}

ret = kprobe_target(rand1);
ret = target(rand1);
unregister_kretprobe(&rp);
if (krph_val != rand1) {
printk(KERN_ERR "Kprobe smoke test failed: "
Expand All @@ -193,6 +182,8 @@ int init_test_probes(void)
{
int ret;

target = kprobe_target;

do {
rand1 = random32();
} while (rand1 <= div_factor);
Expand Down

0 comments on commit 6152208

Please sign in to comment.