diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-01-05 06:47:24 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2011-01-05 06:47:24 -0500 |
commit | 4a1886358b2d68f6f8745bfc10399c2376681acc (patch) | |
tree | 0c1ad280746819db7839915a5f986961ed8ef38e | |
parent | 0e917cc3297f3274993d25b5972c2b1c6f763819 (diff) |
[S390] kprobes: coding style
Correct some minor coding style issues.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/kernel/kprobes.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index 2a19f4154f2d..f227f52ce913 100644 --- a/arch/s390/kernel/kprobes.c +++ b/arch/s390/kernel/kprobes.c | |||
@@ -32,10 +32,10 @@ | |||
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/hardirq.h> | 33 | #include <linux/hardirq.h> |
34 | 34 | ||
35 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; | 35 | DEFINE_PER_CPU(struct kprobe *, current_kprobe); |
36 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 36 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
37 | 37 | ||
38 | struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}}; | 38 | struct kretprobe_blackpoint kretprobe_blacklist[] = { }; |
39 | 39 | ||
40 | static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn) | 40 | static int __kprobes is_prohibited_opcode(kprobe_opcode_t *insn) |
41 | { | 41 | { |
@@ -123,7 +123,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) | |||
123 | return -EINVAL; | 123 | return -EINVAL; |
124 | 124 | ||
125 | /* Make sure the probe isn't going on a difficult instruction */ | 125 | /* Make sure the probe isn't going on a difficult instruction */ |
126 | if (is_prohibited_opcode((kprobe_opcode_t *) p->addr)) | 126 | if (is_prohibited_opcode(p->addr)) |
127 | return -EINVAL; | 127 | return -EINVAL; |
128 | 128 | ||
129 | p->opcode = *p->addr; | 129 | p->opcode = *p->addr; |
@@ -235,7 +235,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, | |||
235 | ri->ret_addr = (kprobe_opcode_t *) regs->gprs[14]; | 235 | ri->ret_addr = (kprobe_opcode_t *) regs->gprs[14]; |
236 | 236 | ||
237 | /* Replace the return addr with trampoline addr */ | 237 | /* Replace the return addr with trampoline addr */ |
238 | regs->gprs[14] = (unsigned long)&kretprobe_trampoline; | 238 | regs->gprs[14] = (unsigned long) &kretprobe_trampoline; |
239 | } | 239 | } |
240 | 240 | ||
241 | static void __kprobes kprobe_reenter_check(struct kprobe_ctlblk *kcb, | 241 | static void __kprobes kprobe_reenter_check(struct kprobe_ctlblk *kcb, |
@@ -353,12 +353,12 @@ static void __used kretprobe_trampoline_holder(void) | |||
353 | static int __kprobes trampoline_probe_handler(struct kprobe *p, | 353 | static int __kprobes trampoline_probe_handler(struct kprobe *p, |
354 | struct pt_regs *regs) | 354 | struct pt_regs *regs) |
355 | { | 355 | { |
356 | struct kretprobe_instance *ri = NULL; | 356 | struct kretprobe_instance *ri; |
357 | struct hlist_head *head, empty_rp; | 357 | struct hlist_head *head, empty_rp; |
358 | struct hlist_node *node, *tmp; | 358 | struct hlist_node *node, *tmp; |
359 | unsigned long flags, orig_ret_address = 0; | 359 | unsigned long flags, orig_ret_address; |
360 | unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; | 360 | unsigned long trampoline_address; |
361 | kprobe_opcode_t *correct_ret_addr = NULL; | 361 | kprobe_opcode_t *correct_ret_addr; |
362 | 362 | ||
363 | INIT_HLIST_HEAD(&empty_rp); | 363 | INIT_HLIST_HEAD(&empty_rp); |
364 | kretprobe_hash_lock(current, &head, &flags); | 364 | kretprobe_hash_lock(current, &head, &flags); |
@@ -376,12 +376,16 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, | |||
376 | * real return address, and all the rest will point to | 376 | * real return address, and all the rest will point to |
377 | * kretprobe_trampoline | 377 | * kretprobe_trampoline |
378 | */ | 378 | */ |
379 | ri = NULL; | ||
380 | orig_ret_address = 0; | ||
381 | correct_ret_addr = NULL; | ||
382 | trampoline_address = (unsigned long) &kretprobe_trampoline; | ||
379 | hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { | 383 | hlist_for_each_entry_safe(ri, node, tmp, head, hlist) { |
380 | if (ri->task != current) | 384 | if (ri->task != current) |
381 | /* another task is sharing our hash bucket */ | 385 | /* another task is sharing our hash bucket */ |
382 | continue; | 386 | continue; |
383 | 387 | ||
384 | orig_ret_address = (unsigned long)ri->ret_addr; | 388 | orig_ret_address = (unsigned long) ri->ret_addr; |
385 | 389 | ||
386 | if (orig_ret_address != trampoline_address) | 390 | if (orig_ret_address != trampoline_address) |
387 | /* | 391 | /* |
@@ -400,7 +404,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, | |||
400 | /* another task is sharing our hash bucket */ | 404 | /* another task is sharing our hash bucket */ |
401 | continue; | 405 | continue; |
402 | 406 | ||
403 | orig_ret_address = (unsigned long)ri->ret_addr; | 407 | orig_ret_address = (unsigned long) ri->ret_addr; |
404 | 408 | ||
405 | if (ri->rp && ri->rp->handler) { | 409 | if (ri->rp && ri->rp->handler) { |
406 | ri->ret_addr = correct_ret_addr; | 410 | ri->ret_addr = correct_ret_addr; |
@@ -409,14 +413,13 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, | |||
409 | 413 | ||
410 | recycle_rp_inst(ri, &empty_rp); | 414 | recycle_rp_inst(ri, &empty_rp); |
411 | 415 | ||
412 | if (orig_ret_address != trampoline_address) { | 416 | if (orig_ret_address != trampoline_address) |
413 | /* | 417 | /* |
414 | * This is the real return address. Any other | 418 | * This is the real return address. Any other |
415 | * instances associated with this task are for | 419 | * instances associated with this task are for |
416 | * other calls deeper on the call stack | 420 | * other calls deeper on the call stack |
417 | */ | 421 | */ |
418 | break; | 422 | break; |
419 | } | ||
420 | } | 423 | } |
421 | 424 | ||
422 | regs->psw.addr = orig_ret_address | PSW_ADDR_AMODE; | 425 | regs->psw.addr = orig_ret_address | PSW_ADDR_AMODE; |
@@ -471,18 +474,18 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) | |||
471 | 474 | ||
472 | static int __kprobes post_kprobe_handler(struct pt_regs *regs) | 475 | static int __kprobes post_kprobe_handler(struct pt_regs *regs) |
473 | { | 476 | { |
474 | struct kprobe *cur = kprobe_running(); | ||
475 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 477 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
478 | struct kprobe *p = kprobe_running(); | ||
476 | 479 | ||
477 | if (!cur) | 480 | if (!p) |
478 | return 0; | 481 | return 0; |
479 | 482 | ||
480 | if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) { | 483 | if (kcb->kprobe_status != KPROBE_REENTER && p->post_handler) { |
481 | kcb->kprobe_status = KPROBE_HIT_SSDONE; | 484 | kcb->kprobe_status = KPROBE_HIT_SSDONE; |
482 | cur->post_handler(cur, regs, 0); | 485 | p->post_handler(p, regs, 0); |
483 | } | 486 | } |
484 | 487 | ||
485 | resume_execution(cur, regs); | 488 | resume_execution(p, regs); |
486 | pop_kprobe(kcb); | 489 | pop_kprobe(kcb); |
487 | preempt_enable_no_resched(); | 490 | preempt_enable_no_resched(); |
488 | 491 | ||
@@ -491,17 +494,16 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs) | |||
491 | * will have PER set, in which case, continue the remaining processing | 494 | * will have PER set, in which case, continue the remaining processing |
492 | * of do_single_step, as if this is not a probe hit. | 495 | * of do_single_step, as if this is not a probe hit. |
493 | */ | 496 | */ |
494 | if (regs->psw.mask & PSW_MASK_PER) { | 497 | if (regs->psw.mask & PSW_MASK_PER) |
495 | return 0; | 498 | return 0; |
496 | } | ||
497 | 499 | ||
498 | return 1; | 500 | return 1; |
499 | } | 501 | } |
500 | 502 | ||
501 | static int __kprobes kprobe_trap_handler(struct pt_regs *regs, int trapnr) | 503 | static int __kprobes kprobe_trap_handler(struct pt_regs *regs, int trapnr) |
502 | { | 504 | { |
503 | struct kprobe *cur = kprobe_running(); | ||
504 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 505 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
506 | struct kprobe *p = kprobe_running(); | ||
505 | const struct exception_table_entry *entry; | 507 | const struct exception_table_entry *entry; |
506 | 508 | ||
507 | switch(kcb->kprobe_status) { | 509 | switch(kcb->kprobe_status) { |
@@ -517,7 +519,7 @@ static int __kprobes kprobe_trap_handler(struct pt_regs *regs, int trapnr) | |||
517 | * and allow the page fault handler to continue as a | 519 | * and allow the page fault handler to continue as a |
518 | * normal page fault. | 520 | * normal page fault. |
519 | */ | 521 | */ |
520 | disable_singlestep(kcb, regs, (unsigned long) cur->addr); | 522 | disable_singlestep(kcb, regs, (unsigned long) p->addr); |
521 | pop_kprobe(kcb); | 523 | pop_kprobe(kcb); |
522 | preempt_enable_no_resched(); | 524 | preempt_enable_no_resched(); |
523 | break; | 525 | break; |
@@ -528,7 +530,7 @@ static int __kprobes kprobe_trap_handler(struct pt_regs *regs, int trapnr) | |||
528 | * we can also use npre/npostfault count for accouting | 530 | * we can also use npre/npostfault count for accouting |
529 | * these specific fault cases. | 531 | * these specific fault cases. |
530 | */ | 532 | */ |
531 | kprobes_inc_nmissed_count(cur); | 533 | kprobes_inc_nmissed_count(p); |
532 | 534 | ||
533 | /* | 535 | /* |
534 | * We come here because instructions in the pre/post | 536 | * We come here because instructions in the pre/post |
@@ -537,7 +539,7 @@ static int __kprobes kprobe_trap_handler(struct pt_regs *regs, int trapnr) | |||
537 | * copy_from_user(), get_user() etc. Let the | 539 | * copy_from_user(), get_user() etc. Let the |
538 | * user-specified handler try to fix it first. | 540 | * user-specified handler try to fix it first. |
539 | */ | 541 | */ |
540 | if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr)) | 542 | if (p->fault_handler && p->fault_handler(p, regs, trapnr)) |
541 | return 1; | 543 | return 1; |
542 | 544 | ||
543 | /* | 545 | /* |
@@ -579,7 +581,7 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) | |||
579 | int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | 581 | int __kprobes kprobe_exceptions_notify(struct notifier_block *self, |
580 | unsigned long val, void *data) | 582 | unsigned long val, void *data) |
581 | { | 583 | { |
582 | struct die_args *args = (struct die_args *)data; | 584 | struct die_args *args = (struct die_args *) data; |
583 | struct pt_regs *regs = args->regs; | 585 | struct pt_regs *regs = args->regs; |
584 | int ret = NOTIFY_DONE; | 586 | int ret = NOTIFY_DONE; |
585 | 587 | ||
@@ -588,16 +590,16 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
588 | 590 | ||
589 | switch (val) { | 591 | switch (val) { |
590 | case DIE_BPT: | 592 | case DIE_BPT: |
591 | if (kprobe_handler(args->regs)) | 593 | if (kprobe_handler(regs)) |
592 | ret = NOTIFY_STOP; | 594 | ret = NOTIFY_STOP; |
593 | break; | 595 | break; |
594 | case DIE_SSTEP: | 596 | case DIE_SSTEP: |
595 | if (post_kprobe_handler(args->regs)) | 597 | if (post_kprobe_handler(regs)) |
596 | ret = NOTIFY_STOP; | 598 | ret = NOTIFY_STOP; |
597 | break; | 599 | break; |
598 | case DIE_TRAP: | 600 | case DIE_TRAP: |
599 | if (!preemptible() && kprobe_running() && | 601 | if (!preemptible() && kprobe_running() && |
600 | kprobe_trap_handler(args->regs, args->trapnr)) | 602 | kprobe_trap_handler(regs, args->trapnr)) |
601 | ret = NOTIFY_STOP; | 603 | ret = NOTIFY_STOP; |
602 | break; | 604 | break; |
603 | default: | 605 | default: |
@@ -619,7 +621,7 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
619 | memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs)); | 621 | memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs)); |
620 | 622 | ||
621 | /* setup return addr to the jprobe handler routine */ | 623 | /* setup return addr to the jprobe handler routine */ |
622 | regs->psw.addr = (unsigned long)(jp->entry) | PSW_ADDR_AMODE; | 624 | regs->psw.addr = (unsigned long) jp->entry | PSW_ADDR_AMODE; |
623 | regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT); | 625 | regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT); |
624 | 626 | ||
625 | /* r15 is the stack pointer */ | 627 | /* r15 is the stack pointer */ |
@@ -654,19 +656,17 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
654 | return 1; | 656 | return 1; |
655 | } | 657 | } |
656 | 658 | ||
657 | static struct kprobe trampoline_p = { | 659 | static struct kprobe trampoline = { |
658 | .addr = (kprobe_opcode_t *) & kretprobe_trampoline, | 660 | .addr = (kprobe_opcode_t *) &kretprobe_trampoline, |
659 | .pre_handler = trampoline_probe_handler | 661 | .pre_handler = trampoline_probe_handler |
660 | }; | 662 | }; |
661 | 663 | ||
662 | int __init arch_init_kprobes(void) | 664 | int __init arch_init_kprobes(void) |
663 | { | 665 | { |
664 | return register_kprobe(&trampoline_p); | 666 | return register_kprobe(&trampoline); |
665 | } | 667 | } |
666 | 668 | ||
667 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) | 669 | int __kprobes arch_trampoline_kprobe(struct kprobe *p) |
668 | { | 670 | { |
669 | if (p->addr == (kprobe_opcode_t *) & kretprobe_trampoline) | 671 | return p->addr == (kprobe_opcode_t *) &kretprobe_trampoline; |
670 | return 1; | ||
671 | return 0; | ||
672 | } | 672 | } |