Commit feac6e21 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman

lkdtm: convert to using pr_* for reports

Move to using pr_* calls instead of printk calls for reporting.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bb948c9
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
* *
* See Documentation/fault-injection/provoke-crashes.txt for instructions * See Documentation/fault-injection/provoke-crashes.txt for instructions
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/fs.h> #include <linux/fs.h>
...@@ -493,7 +494,7 @@ static void lkdtm_handler(void) ...@@ -493,7 +494,7 @@ static void lkdtm_handler(void)
spin_lock_irqsave(&count_lock, flags); spin_lock_irqsave(&count_lock, flags);
count--; count--;
printk(KERN_INFO "lkdtm: Crash point %s of type %s hit, trigger in %d rounds\n", pr_info("Crash point %s of type %s hit, trigger in %d rounds\n",
cp_name_to_str(cpoint), cp_type_to_str(cptype), count); cp_name_to_str(cpoint), cp_type_to_str(cptype), count);
if (count == 0) { if (count == 0) {
...@@ -551,18 +552,18 @@ static int lkdtm_register_cpoint(enum cname which) ...@@ -551,18 +552,18 @@ static int lkdtm_register_cpoint(enum cname which)
lkdtm.kp.symbol_name = "generic_ide_ioctl"; lkdtm.kp.symbol_name = "generic_ide_ioctl";
lkdtm.entry = (kprobe_opcode_t*) jp_generic_ide_ioctl; lkdtm.entry = (kprobe_opcode_t*) jp_generic_ide_ioctl;
#else #else
printk(KERN_INFO "lkdtm: Crash point not available\n"); pr_info("Crash point not available\n");
return -EINVAL; return -EINVAL;
#endif #endif
break; break;
default: default:
printk(KERN_INFO "lkdtm: Invalid Crash Point\n"); pr_info("Invalid Crash Point\n");
return -EINVAL; return -EINVAL;
} }
cpoint = which; cpoint = which;
if ((ret = register_jprobe(&lkdtm)) < 0) { if ((ret = register_jprobe(&lkdtm)) < 0) {
printk(KERN_INFO "lkdtm: Couldn't register jprobe\n"); pr_info("Couldn't register jprobe\n");
cpoint = CN_INVALID; cpoint = CN_INVALID;
} }
...@@ -709,8 +710,7 @@ static ssize_t direct_entry(struct file *f, const char __user *user_buf, ...@@ -709,8 +710,7 @@ static ssize_t direct_entry(struct file *f, const char __user *user_buf,
if (type == CT_NONE) if (type == CT_NONE)
return -EINVAL; return -EINVAL;
printk(KERN_INFO "lkdtm: Performing direct entry %s\n", pr_info("Performing direct entry %s\n", cp_type_to_str(type));
cp_type_to_str(type));
lkdtm_do_action(type); lkdtm_do_action(type);
*off += count; *off += count;
...@@ -772,7 +772,7 @@ static int __init lkdtm_module_init(void) ...@@ -772,7 +772,7 @@ static int __init lkdtm_module_init(void)
/* Register debugfs interface */ /* Register debugfs interface */
lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL); lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL);
if (!lkdtm_debugfs_root) { if (!lkdtm_debugfs_root) {
printk(KERN_ERR "lkdtm: creating root dir failed\n"); pr_err("creating root dir failed\n");
return -ENODEV; return -ENODEV;
} }
...@@ -787,28 +787,26 @@ static int __init lkdtm_module_init(void) ...@@ -787,28 +787,26 @@ static int __init lkdtm_module_init(void)
de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root,
NULL, &cur->fops); NULL, &cur->fops);
if (de == NULL) { if (de == NULL) {
printk(KERN_ERR "lkdtm: could not create %s\n", pr_err("could not create %s\n", cur->name);
cur->name);
goto out_err; goto out_err;
} }
} }
if (lkdtm_parse_commandline() == -EINVAL) { if (lkdtm_parse_commandline() == -EINVAL) {
printk(KERN_INFO "lkdtm: Invalid command\n"); pr_info("Invalid command\n");
goto out_err; goto out_err;
} }
if (cpoint != CN_INVALID && cptype != CT_NONE) { if (cpoint != CN_INVALID && cptype != CT_NONE) {
ret = lkdtm_register_cpoint(cpoint); ret = lkdtm_register_cpoint(cpoint);
if (ret < 0) { if (ret < 0) {
printk(KERN_INFO "lkdtm: Invalid crash point %d\n", pr_info("Invalid crash point %d\n", cpoint);
cpoint);
goto out_err; goto out_err;
} }
printk(KERN_INFO "lkdtm: Crash point %s of type %s registered\n", pr_info("Crash point %s of type %s registered\n",
cpoint_name, cpoint_type); cpoint_name, cpoint_type);
} else { } else {
printk(KERN_INFO "lkdtm: No crash points registered, enable through debugfs\n"); pr_info("No crash points registered, enable through debugfs\n");
} }
return 0; return 0;
...@@ -823,7 +821,7 @@ static void __exit lkdtm_module_exit(void) ...@@ -823,7 +821,7 @@ static void __exit lkdtm_module_exit(void)
debugfs_remove_recursive(lkdtm_debugfs_root); debugfs_remove_recursive(lkdtm_debugfs_root);
unregister_jprobe(&lkdtm); unregister_jprobe(&lkdtm);
printk(KERN_INFO "lkdtm: Crash point unregistered\n"); pr_info("Crash point unregistered\n");
} }
module_init(lkdtm_module_init); module_init(lkdtm_module_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment