Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kees Cook and committed by
Greg Kroah-Hartman
feac6e21 6bb948c9

+15 -17
+15 -17
drivers/misc/lkdtm.c
··· 30 30 * 31 31 * See Documentation/fault-injection/provoke-crashes.txt for instructions 32 32 */ 33 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 33 34 34 35 #include <linux/kernel.h> 35 36 #include <linux/fs.h> ··· 494 493 495 494 spin_lock_irqsave(&count_lock, flags); 496 495 count--; 497 - printk(KERN_INFO "lkdtm: Crash point %s of type %s hit, trigger in %d rounds\n", 498 - cp_name_to_str(cpoint), cp_type_to_str(cptype), count); 496 + 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); 499 498 500 499 if (count == 0) { 501 500 do_it = true; ··· 552 551 lkdtm.kp.symbol_name = "generic_ide_ioctl"; 553 552 lkdtm.entry = (kprobe_opcode_t*) jp_generic_ide_ioctl; 554 553 #else 555 - printk(KERN_INFO "lkdtm: Crash point not available\n"); 554 + pr_info("Crash point not available\n"); 556 555 return -EINVAL; 557 556 #endif 558 557 break; 559 558 default: 560 - printk(KERN_INFO "lkdtm: Invalid Crash Point\n"); 559 + pr_info("Invalid Crash Point\n"); 561 560 return -EINVAL; 562 561 } 563 562 564 563 cpoint = which; 565 564 if ((ret = register_jprobe(&lkdtm)) < 0) { 566 - printk(KERN_INFO "lkdtm: Couldn't register jprobe\n"); 565 + pr_info("Couldn't register jprobe\n"); 567 566 cpoint = CN_INVALID; 568 567 } 569 568 ··· 710 709 if (type == CT_NONE) 711 710 return -EINVAL; 712 711 713 - printk(KERN_INFO "lkdtm: Performing direct entry %s\n", 714 - cp_type_to_str(type)); 712 + pr_info("Performing direct entry %s\n", cp_type_to_str(type)); 715 713 lkdtm_do_action(type); 716 714 *off += count; 717 715 ··· 772 772 /* Register debugfs interface */ 773 773 lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL); 774 774 if (!lkdtm_debugfs_root) { 775 - printk(KERN_ERR "lkdtm: creating root dir failed\n"); 775 + pr_err("creating root dir failed\n"); 776 776 return -ENODEV; 777 777 } 778 778 ··· 787 787 de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, 788 788 NULL, &cur->fops); 789 789 if (de == NULL) { 790 - printk(KERN_ERR "lkdtm: could not create %s\n", 791 - cur->name); 790 + pr_err("could not create %s\n", cur->name); 792 791 goto out_err; 793 792 } 794 793 } 795 794 796 795 if (lkdtm_parse_commandline() == -EINVAL) { 797 - printk(KERN_INFO "lkdtm: Invalid command\n"); 796 + pr_info("Invalid command\n"); 798 797 goto out_err; 799 798 } 800 799 801 800 if (cpoint != CN_INVALID && cptype != CT_NONE) { 802 801 ret = lkdtm_register_cpoint(cpoint); 803 802 if (ret < 0) { 804 - printk(KERN_INFO "lkdtm: Invalid crash point %d\n", 805 - cpoint); 803 + pr_info("Invalid crash point %d\n", cpoint); 806 804 goto out_err; 807 805 } 808 - printk(KERN_INFO "lkdtm: Crash point %s of type %s registered\n", 809 - cpoint_name, cpoint_type); 806 + pr_info("Crash point %s of type %s registered\n", 807 + cpoint_name, cpoint_type); 810 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 812 return 0; ··· 821 823 debugfs_remove_recursive(lkdtm_debugfs_root); 822 824 823 825 unregister_jprobe(&lkdtm); 824 - printk(KERN_INFO "lkdtm: Crash point unregistered\n"); 826 + pr_info("Crash point unregistered\n"); 825 827 } 826 828 827 829 module_init(lkdtm_module_init);