aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2014-02-09 16:48:46 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-14 15:30:20 -0500
commitfeac6e2146ddc04626d7c1b32b33ff3acb26feee (patch)
tree146a00121d124d7b6fa5349b97d3af2706fc5055
parent6bb948c9e500d24321c36c67c81daf8d1a7e561e (diff)
lkdtm: convert to using pr_* for reports
Move to using pr_* calls instead of printk calls for reporting. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/lkdtm.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index 49c7a23f02fc..e910b3c5331c 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -30,6 +30,7 @@
30 * 30 *
31 * See Documentation/fault-injection/provoke-crashes.txt for instructions 31 * See Documentation/fault-injection/provoke-crashes.txt for instructions
32 */ 32 */
33#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
33 34
34#include <linux/kernel.h> 35#include <linux/kernel.h>
35#include <linux/fs.h> 36#include <linux/fs.h>
@@ -493,8 +494,8 @@ static void lkdtm_handler(void)
493 494
494 spin_lock_irqsave(&count_lock, flags); 495 spin_lock_irqsave(&count_lock, flags);
495 count--; 496 count--;
496 printk(KERN_INFO "lkdtm: Crash point %s of type %s hit, trigger in %d rounds\n", 497 pr_info("Crash point %s of type %s hit, trigger in %d rounds\n",
497 cp_name_to_str(cpoint), cp_type_to_str(cptype), count); 498 cp_name_to_str(cpoint), cp_type_to_str(cptype), count);
498 499
499 if (count == 0) { 500 if (count == 0) {
500 do_it = true; 501 do_it = true;
@@ -551,18 +552,18 @@ static int lkdtm_register_cpoint(enum cname which)
551 lkdtm.kp.symbol_name = "generic_ide_ioctl"; 552 lkdtm.kp.symbol_name = "generic_ide_ioctl";
552 lkdtm.entry = (kprobe_opcode_t*) jp_generic_ide_ioctl; 553 lkdtm.entry = (kprobe_opcode_t*) jp_generic_ide_ioctl;
553#else 554#else
554 printk(KERN_INFO "lkdtm: Crash point not available\n"); 555 pr_info("Crash point not available\n");
555 return -EINVAL; 556 return -EINVAL;
556#endif 557#endif
557 break; 558 break;
558 default: 559 default:
559 printk(KERN_INFO "lkdtm: Invalid Crash Point\n"); 560 pr_info("Invalid Crash Point\n");
560 return -EINVAL; 561 return -EINVAL;
561 } 562 }
562 563
563 cpoint = which; 564 cpoint = which;
564 if ((ret = register_jprobe(&lkdtm)) < 0) { 565 if ((ret = register_jprobe(&lkdtm)) < 0) {
565 printk(KERN_INFO "lkdtm: Couldn't register jprobe\n"); 566 pr_info("Couldn't register jprobe\n");
566 cpoint = CN_INVALID; 567 cpoint = CN_INVALID;
567 } 568 }
568 569
@@ -709,8 +710,7 @@ static ssize_t direct_entry(struct file *f, const char __user *user_buf,
709 if (type == CT_NONE) 710 if (type == CT_NONE)
710 return -EINVAL; 711 return -EINVAL;
711 712
712 printk(KERN_INFO "lkdtm: Performing direct entry %s\n", 713 pr_info("Performing direct entry %s\n", cp_type_to_str(type));
713 cp_type_to_str(type));
714 lkdtm_do_action(type); 714 lkdtm_do_action(type);
715 *off += count; 715 *off += count;
716 716
@@ -772,7 +772,7 @@ static int __init lkdtm_module_init(void)
772 /* Register debugfs interface */ 772 /* Register debugfs interface */
773 lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL); 773 lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL);
774 if (!lkdtm_debugfs_root) { 774 if (!lkdtm_debugfs_root) {
775 printk(KERN_ERR "lkdtm: creating root dir failed\n"); 775 pr_err("creating root dir failed\n");
776 return -ENODEV; 776 return -ENODEV;
777 } 777 }
778 778
@@ -787,28 +787,26 @@ static int __init lkdtm_module_init(void)
787 de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, 787 de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root,
788 NULL, &cur->fops); 788 NULL, &cur->fops);
789 if (de == NULL) { 789 if (de == NULL) {
790 printk(KERN_ERR "lkdtm: could not create %s\n", 790 pr_err("could not create %s\n", cur->name);
791 cur->name);
792 goto out_err; 791 goto out_err;
793 } 792 }
794 } 793 }
795 794
796 if (lkdtm_parse_commandline() == -EINVAL) { 795 if (lkdtm_parse_commandline() == -EINVAL) {
797 printk(KERN_INFO "lkdtm: Invalid command\n"); 796 pr_info("Invalid command\n");
798 goto out_err; 797 goto out_err;
799 } 798 }
800 799
801 if (cpoint != CN_INVALID && cptype != CT_NONE) { 800 if (cpoint != CN_INVALID && cptype != CT_NONE) {
802 ret = lkdtm_register_cpoint(cpoint); 801 ret = lkdtm_register_cpoint(cpoint);
803 if (ret < 0) { 802 if (ret < 0) {
804 printk(KERN_INFO "lkdtm: Invalid crash point %d\n", 803 pr_info("Invalid crash point %d\n", cpoint);
805 cpoint);
806 goto out_err; 804 goto out_err;
807 } 805 }
808 printk(KERN_INFO "lkdtm: Crash point %s of type %s registered\n", 806 pr_info("Crash point %s of type %s registered\n",
809 cpoint_name, cpoint_type); 807 cpoint_name, cpoint_type);
810 } else { 808 } else {
811 printk(KERN_INFO "lkdtm: No crash points registered, enable through debugfs\n"); 809 pr_info("No crash points registered, enable through debugfs\n");
812 } 810 }
813 811
814 return 0; 812 return 0;
@@ -823,7 +821,7 @@ static void __exit lkdtm_module_exit(void)
823 debugfs_remove_recursive(lkdtm_debugfs_root); 821 debugfs_remove_recursive(lkdtm_debugfs_root);
824 822
825 unregister_jprobe(&lkdtm); 823 unregister_jprobe(&lkdtm);
826 printk(KERN_INFO "lkdtm: Crash point unregistered\n"); 824 pr_info("Crash point unregistered\n");
827} 825}
828 826
829module_init(lkdtm_module_init); 827module_init(lkdtm_module_init);