diff options
author | Richard Guy Briggs <rgb@redhat.com> | 2014-01-27 17:38:42 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2014-03-07 11:48:15 -0500 |
commit | f952d10ff40b436a8ef156a74ec327abe303823d (patch) | |
tree | 50f0c9e87aaf68d156aa50fe27a1c99f3d480f15 | |
parent | b7d3622a39fde7658170b7f3cf6c6889bb8db30d (diff) |
audit: Use more current logging style again
Add pr_fmt to prefix "audit: " to output
Convert printk(KERN_<LEVEL> to pr_<level>
Coalesce formats
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
-rw-r--r-- | kernel/auditfilter.c | 12 | ||||
-rw-r--r-- | kernel/auditsc.c | 31 |
2 files changed, 22 insertions, 21 deletions
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 14a78cca384e..3152d1aea164 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -19,6 +19,8 @@ | |||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
23 | |||
22 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
23 | #include <linux/audit.h> | 25 | #include <linux/audit.h> |
24 | #include <linux/kthread.h> | 26 | #include <linux/kthread.h> |
@@ -247,7 +249,7 @@ static inline struct audit_entry *audit_to_entry_common(struct audit_rule *rule) | |||
247 | ; | 249 | ; |
248 | } | 250 | } |
249 | if (unlikely(rule->action == AUDIT_POSSIBLE)) { | 251 | if (unlikely(rule->action == AUDIT_POSSIBLE)) { |
250 | printk(KERN_ERR "AUDIT_POSSIBLE is deprecated\n"); | 252 | pr_err("AUDIT_POSSIBLE is deprecated\n"); |
251 | goto exit_err; | 253 | goto exit_err; |
252 | } | 254 | } |
253 | if (rule->action != AUDIT_NEVER && rule->action != AUDIT_ALWAYS) | 255 | if (rule->action != AUDIT_NEVER && rule->action != AUDIT_ALWAYS) |
@@ -477,8 +479,8 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data, | |||
477 | /* Keep currently invalid fields around in case they | 479 | /* Keep currently invalid fields around in case they |
478 | * become valid after a policy reload. */ | 480 | * become valid after a policy reload. */ |
479 | if (err == -EINVAL) { | 481 | if (err == -EINVAL) { |
480 | printk(KERN_WARNING "audit rule for LSM " | 482 | pr_warn("audit rule for LSM \'%s\' is invalid\n", |
481 | "\'%s\' is invalid\n", str); | 483 | str); |
482 | err = 0; | 484 | err = 0; |
483 | } | 485 | } |
484 | if (err) { | 486 | if (err) { |
@@ -707,8 +709,8 @@ static inline int audit_dupe_lsm_field(struct audit_field *df, | |||
707 | /* Keep currently invalid fields around in case they | 709 | /* Keep currently invalid fields around in case they |
708 | * become valid after a policy reload. */ | 710 | * become valid after a policy reload. */ |
709 | if (ret == -EINVAL) { | 711 | if (ret == -EINVAL) { |
710 | printk(KERN_WARNING "audit rule for LSM \'%s\' is " | 712 | pr_warn("audit rule for LSM \'%s\' is invalid\n", |
711 | "invalid\n", df->lsm_str); | 713 | df->lsm_str); |
712 | ret = 0; | 714 | ret = 0; |
713 | } | 715 | } |
714 | 716 | ||
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 10176cd5956a..6874c1fd453d 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -42,6 +42,8 @@ | |||
42 | * and <dustin.kirkland@us.ibm.com> for LSPP certification compliance. | 42 | * and <dustin.kirkland@us.ibm.com> for LSPP certification compliance. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
46 | |||
45 | #include <linux/init.h> | 47 | #include <linux/init.h> |
46 | #include <asm/types.h> | 48 | #include <asm/types.h> |
47 | #include <linux/atomic.h> | 49 | #include <linux/atomic.h> |
@@ -850,16 +852,15 @@ static inline void audit_free_names(struct audit_context *context) | |||
850 | if (context->put_count + context->ino_count != context->name_count) { | 852 | if (context->put_count + context->ino_count != context->name_count) { |
851 | int i = 0; | 853 | int i = 0; |
852 | 854 | ||
853 | printk(KERN_ERR "%s:%d(:%d): major=%d in_syscall=%d" | 855 | pr_err("%s:%d(:%d): major=%d in_syscall=%d" |
854 | " name_count=%d put_count=%d" | 856 | " name_count=%d put_count=%d ino_count=%d" |
855 | " ino_count=%d [NOT freeing]\n", | 857 | " [NOT freeing]\n", __FILE__, __LINE__, |
856 | __FILE__, __LINE__, | ||
857 | context->serial, context->major, context->in_syscall, | 858 | context->serial, context->major, context->in_syscall, |
858 | context->name_count, context->put_count, | 859 | context->name_count, context->put_count, |
859 | context->ino_count); | 860 | context->ino_count); |
860 | list_for_each_entry(n, &context->names_list, list) { | 861 | list_for_each_entry(n, &context->names_list, list) { |
861 | printk(KERN_ERR "names[%d] = %p = %s\n", i++, | 862 | pr_err("names[%d] = %p = %s\n", i++, n->name, |
862 | n->name, n->name->name ?: "(null)"); | 863 | n->name->name ?: "(null)"); |
863 | } | 864 | } |
864 | dump_stack(); | 865 | dump_stack(); |
865 | return; | 866 | return; |
@@ -1550,7 +1551,7 @@ static inline void handle_one(const struct inode *inode) | |||
1550 | if (likely(put_tree_ref(context, chunk))) | 1551 | if (likely(put_tree_ref(context, chunk))) |
1551 | return; | 1552 | return; |
1552 | if (unlikely(!grow_tree_refs(context))) { | 1553 | if (unlikely(!grow_tree_refs(context))) { |
1553 | printk(KERN_WARNING "out of memory, audit has lost a tree reference\n"); | 1554 | pr_warn("out of memory, audit has lost a tree reference\n"); |
1554 | audit_set_auditable(context); | 1555 | audit_set_auditable(context); |
1555 | audit_put_chunk(chunk); | 1556 | audit_put_chunk(chunk); |
1556 | unroll_tree_refs(context, p, count); | 1557 | unroll_tree_refs(context, p, count); |
@@ -1609,8 +1610,7 @@ retry: | |||
1609 | goto retry; | 1610 | goto retry; |
1610 | } | 1611 | } |
1611 | /* too bad */ | 1612 | /* too bad */ |
1612 | printk(KERN_WARNING | 1613 | pr_warn("out of memory, audit has lost a tree reference\n"); |
1613 | "out of memory, audit has lost a tree reference\n"); | ||
1614 | unroll_tree_refs(context, p, count); | 1614 | unroll_tree_refs(context, p, count); |
1615 | audit_set_auditable(context); | 1615 | audit_set_auditable(context); |
1616 | return; | 1616 | return; |
@@ -1682,7 +1682,7 @@ void __audit_getname(struct filename *name) | |||
1682 | 1682 | ||
1683 | if (!context->in_syscall) { | 1683 | if (!context->in_syscall) { |
1684 | #if AUDIT_DEBUG == 2 | 1684 | #if AUDIT_DEBUG == 2 |
1685 | printk(KERN_ERR "%s:%d(:%d): ignoring getname(%p)\n", | 1685 | pr_err("%s:%d(:%d): ignoring getname(%p)\n", |
1686 | __FILE__, __LINE__, context->serial, name); | 1686 | __FILE__, __LINE__, context->serial, name); |
1687 | dump_stack(); | 1687 | dump_stack(); |
1688 | #endif | 1688 | #endif |
@@ -1721,15 +1721,15 @@ void audit_putname(struct filename *name) | |||
1721 | BUG_ON(!context); | 1721 | BUG_ON(!context); |
1722 | if (!context->in_syscall) { | 1722 | if (!context->in_syscall) { |
1723 | #if AUDIT_DEBUG == 2 | 1723 | #if AUDIT_DEBUG == 2 |
1724 | printk(KERN_ERR "%s:%d(:%d): final_putname(%p)\n", | 1724 | pr_err("%s:%d(:%d): final_putname(%p)\n", |
1725 | __FILE__, __LINE__, context->serial, name); | 1725 | __FILE__, __LINE__, context->serial, name); |
1726 | if (context->name_count) { | 1726 | if (context->name_count) { |
1727 | struct audit_names *n; | 1727 | struct audit_names *n; |
1728 | int i = 0; | 1728 | int i = 0; |
1729 | 1729 | ||
1730 | list_for_each_entry(n, &context->names_list, list) | 1730 | list_for_each_entry(n, &context->names_list, list) |
1731 | printk(KERN_ERR "name[%d] = %p = %s\n", i++, | 1731 | pr_err("name[%d] = %p = %s\n", i++, n->name, |
1732 | n->name, n->name->name ?: "(null)"); | 1732 | n->name->name ?: "(null)"); |
1733 | } | 1733 | } |
1734 | #endif | 1734 | #endif |
1735 | final_putname(name); | 1735 | final_putname(name); |
@@ -1738,9 +1738,8 @@ void audit_putname(struct filename *name) | |||
1738 | else { | 1738 | else { |
1739 | ++context->put_count; | 1739 | ++context->put_count; |
1740 | if (context->put_count > context->name_count) { | 1740 | if (context->put_count > context->name_count) { |
1741 | printk(KERN_ERR "%s:%d(:%d): major=%d" | 1741 | pr_err("%s:%d(:%d): major=%d in_syscall=%d putname(%p)" |
1742 | " in_syscall=%d putname(%p) name_count=%d" | 1742 | " name_count=%d put_count=%d\n", |
1743 | " put_count=%d\n", | ||
1744 | __FILE__, __LINE__, | 1743 | __FILE__, __LINE__, |
1745 | context->serial, context->major, | 1744 | context->serial, context->major, |
1746 | context->in_syscall, name->name, | 1745 | context->in_syscall, name->name, |