diff options
author | Joe Perches <joe@perches.com> | 2014-01-14 13:33:12 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2014-01-14 14:53:54 -0500 |
commit | d957f7b726ccce4967ae0d668b5b10f0f1d10401 (patch) | |
tree | f7f3e7f0f49440c915198e7e1ee2671a12446b08 /kernel/audit.c | |
parent | b8dbc3241fff043213e8be8e798d45eb6ed28b96 (diff) |
audit: Use more current logging style
Add pr_fmt to prefix "audit: " to output
Convert printk(KERN_<LEVEL> to pr_<level>
Coalesce formats
Use pr_cont
Move a brace after switch
Signed-off-by: Joe Perches <joe@perches.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index b5e6fd81949a..5f4766f5216d 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -41,6 +41,8 @@ | |||
41 | * Example user-space utilities: http://people.redhat.com/sgrubb/audit/ | 41 | * Example user-space utilities: http://people.redhat.com/sgrubb/audit/ |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
45 | |||
44 | #include <linux/init.h> | 46 | #include <linux/init.h> |
45 | #include <asm/types.h> | 47 | #include <asm/types.h> |
46 | #include <linux/atomic.h> | 48 | #include <linux/atomic.h> |
@@ -194,13 +196,12 @@ static void audit_set_portid(struct audit_buffer *ab, __u32 portid) | |||
194 | 196 | ||
195 | void audit_panic(const char *message) | 197 | void audit_panic(const char *message) |
196 | { | 198 | { |
197 | switch (audit_failure) | 199 | switch (audit_failure) { |
198 | { | ||
199 | case AUDIT_FAIL_SILENT: | 200 | case AUDIT_FAIL_SILENT: |
200 | break; | 201 | break; |
201 | case AUDIT_FAIL_PRINTK: | 202 | case AUDIT_FAIL_PRINTK: |
202 | if (printk_ratelimit()) | 203 | if (printk_ratelimit()) |
203 | printk(KERN_ERR "audit: %s\n", message); | 204 | pr_err("%s\n", message); |
204 | break; | 205 | break; |
205 | case AUDIT_FAIL_PANIC: | 206 | case AUDIT_FAIL_PANIC: |
206 | /* test audit_pid since printk is always losey, why bother? */ | 207 | /* test audit_pid since printk is always losey, why bother? */ |
@@ -271,9 +272,7 @@ void audit_log_lost(const char *message) | |||
271 | 272 | ||
272 | if (print) { | 273 | if (print) { |
273 | if (printk_ratelimit()) | 274 | if (printk_ratelimit()) |
274 | printk(KERN_WARNING | 275 | pr_warn("audit_lost=%d audit_rate_limit=%d audit_backlog_limit=%d\n", |
275 | "audit: audit_lost=%d audit_rate_limit=%d " | ||
276 | "audit_backlog_limit=%d\n", | ||
277 | atomic_read(&audit_lost), | 276 | atomic_read(&audit_lost), |
278 | audit_rate_limit, | 277 | audit_rate_limit, |
279 | audit_backlog_limit); | 278 | audit_backlog_limit); |
@@ -394,7 +393,7 @@ static void audit_printk_skb(struct sk_buff *skb) | |||
394 | 393 | ||
395 | if (nlh->nlmsg_type != AUDIT_EOE) { | 394 | if (nlh->nlmsg_type != AUDIT_EOE) { |
396 | if (printk_ratelimit()) | 395 | if (printk_ratelimit()) |
397 | printk(KERN_NOTICE "type=%d %s\n", nlh->nlmsg_type, data); | 396 | pr_notice("type=%d %s\n", nlh->nlmsg_type, data); |
398 | else | 397 | else |
399 | audit_log_lost("printk limit exceeded\n"); | 398 | audit_log_lost("printk limit exceeded\n"); |
400 | } | 399 | } |
@@ -411,7 +410,7 @@ static void kauditd_send_skb(struct sk_buff *skb) | |||
411 | if (err < 0) { | 410 | if (err < 0) { |
412 | BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */ | 411 | BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */ |
413 | if (audit_pid) { | 412 | if (audit_pid) { |
414 | printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); | 413 | pr_err("*NO* daemon at audit_pid=%d\n", audit_pid); |
415 | audit_log_lost("auditd disappeared\n"); | 414 | audit_log_lost("auditd disappeared\n"); |
416 | audit_pid = 0; | 415 | audit_pid = 0; |
417 | audit_sock = NULL; | 416 | audit_sock = NULL; |
@@ -1068,7 +1067,7 @@ static int __net_init audit_net_init(struct net *net) | |||
1068 | 1067 | ||
1069 | struct audit_net *aunet = net_generic(net, audit_net_id); | 1068 | struct audit_net *aunet = net_generic(net, audit_net_id); |
1070 | 1069 | ||
1071 | pr_info("audit: initializing netlink socket in namespace\n"); | 1070 | pr_info("initializing netlink socket in namespace\n"); |
1072 | 1071 | ||
1073 | aunet->nlsk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg); | 1072 | aunet->nlsk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg); |
1074 | if (aunet->nlsk == NULL) { | 1073 | if (aunet->nlsk == NULL) { |
@@ -1108,8 +1107,8 @@ static int __init audit_init(void) | |||
1108 | if (audit_initialized == AUDIT_DISABLED) | 1107 | if (audit_initialized == AUDIT_DISABLED) |
1109 | return 0; | 1108 | return 0; |
1110 | 1109 | ||
1111 | pr_info("audit: initializing netlink subsys (%s)\n", | 1110 | pr_info("initializing netlink subsys (%s)\n", |
1112 | audit_default ? "enabled" : "disabled"); | 1111 | audit_default ? "enabled" : "disabled"); |
1113 | register_pernet_subsys(&audit_net_ops); | 1112 | register_pernet_subsys(&audit_net_ops); |
1114 | 1113 | ||
1115 | skb_queue_head_init(&audit_skb_queue); | 1114 | skb_queue_head_init(&audit_skb_queue); |
@@ -1134,7 +1133,7 @@ static int __init audit_enable(char *str) | |||
1134 | if (!audit_default) | 1133 | if (!audit_default) |
1135 | audit_initialized = AUDIT_DISABLED; | 1134 | audit_initialized = AUDIT_DISABLED; |
1136 | 1135 | ||
1137 | pr_info("audit: %s\n", audit_default ? | 1136 | pr_info("%s\n", audit_default ? |
1138 | "enabled (after initialization)" : "disabled (until reboot)"); | 1137 | "enabled (after initialization)" : "disabled (until reboot)"); |
1139 | 1138 | ||
1140 | return 1; | 1139 | return 1; |
@@ -1146,15 +1145,16 @@ __setup("audit=", audit_enable); | |||
1146 | static int __init audit_backlog_limit_set(char *str) | 1145 | static int __init audit_backlog_limit_set(char *str) |
1147 | { | 1146 | { |
1148 | long int audit_backlog_limit_arg; | 1147 | long int audit_backlog_limit_arg; |
1148 | |||
1149 | pr_info("audit_backlog_limit: "); | 1149 | pr_info("audit_backlog_limit: "); |
1150 | if (kstrtol(str, 0, &audit_backlog_limit_arg)) { | 1150 | if (kstrtol(str, 0, &audit_backlog_limit_arg)) { |
1151 | printk("using default of %d, unable to parse %s\n", | 1151 | pr_cont("using default of %d, unable to parse %s\n", |
1152 | audit_backlog_limit, str); | 1152 | audit_backlog_limit, str); |
1153 | return 1; | 1153 | return 1; |
1154 | } | 1154 | } |
1155 | if (audit_backlog_limit_arg >= 0) | 1155 | if (audit_backlog_limit_arg >= 0) |
1156 | audit_backlog_limit = (int)audit_backlog_limit_arg; | 1156 | audit_backlog_limit = (int)audit_backlog_limit_arg; |
1157 | printk("%d\n", audit_backlog_limit); | 1157 | pr_cont("%d\n", audit_backlog_limit); |
1158 | 1158 | ||
1159 | return 1; | 1159 | return 1; |
1160 | } | 1160 | } |
@@ -1336,11 +1336,9 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, | |||
1336 | } | 1336 | } |
1337 | } | 1337 | } |
1338 | if (audit_rate_check() && printk_ratelimit()) | 1338 | if (audit_rate_check() && printk_ratelimit()) |
1339 | printk(KERN_WARNING | 1339 | pr_warn("audit_backlog=%d > audit_backlog_limit=%d\n", |
1340 | "audit: audit_backlog=%d > " | 1340 | skb_queue_len(&audit_skb_queue), |
1341 | "audit_backlog_limit=%d\n", | 1341 | audit_backlog_limit); |
1342 | skb_queue_len(&audit_skb_queue), | ||
1343 | audit_backlog_limit); | ||
1344 | audit_log_lost("backlog limit exceeded"); | 1342 | audit_log_lost("backlog limit exceeded"); |
1345 | audit_backlog_wait_time = audit_backlog_wait_overflow; | 1343 | audit_backlog_wait_time = audit_backlog_wait_overflow; |
1346 | wake_up(&audit_backlog_wait); | 1344 | wake_up(&audit_backlog_wait); |