[PATCH 4/4] kernel:audit.c fixed a coding style issue

Joan Jani igiann at hotmail.com
Tue Feb 28 21:49:35 UTC 2017


This patch fixes the following checkpath.pl warning
 WARNING: Block comments use a trailing */ on a separate line

like

kernel/audit.c:135: WARNING: Block comments use a trailing */ on a separate line
kernel/audit.c:170: WARNING: Block comments use a trailing */ on a separate line
kernel/audit.c:174: WARNING: Block comments use a trailing */ on a separate line
kernel/audit.c:181: WARNING: Block comments use a trailing */ on a

and some more style. No changes to code

Signed-off-by: Joan Jani <igiann at hotmail.com>
---
 kernel/audit.c | 53 ++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 19 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index e794544..62d90d9 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -70,7 +70,8 @@
 #include "audit.h"
 
 /* No auditing will take place until audit_initialized == AUDIT_INITIALIZED.
- * (Initialization happens after skb_init is called.) */
+ * (Initialization happens after skb_init is called.)
+ */
 #define AUDIT_DISABLED		-1
 #define AUDIT_UNINITIALIZED	0
 #define AUDIT_INITIALIZED	1
@@ -100,11 +101,13 @@ static __u32	audit_nlk_portid;
 
 /* If audit_rate_limit is non-zero, limit the rate of sending audit records
  * to that number per second.  This prevents DoS attacks, but results in
- * audit records being dropped. */
+ * audit records being dropped.
+ */
 static u32	audit_rate_limit;
 
 /* Number of outstanding audit_buffers allowed.
- * When set to zero, this means unlimited. */
+ * When set to zero, this means unlimited.
+ */
 static u32	audit_backlog_limit = 64;
 #define AUDIT_BACKLOG_WAIT_TIME (60 * HZ)
 static u32	audit_backlog_wait_time = AUDIT_BACKLOG_WAIT_TIME;
@@ -115,7 +118,7 @@ pid_t		audit_sig_pid = -1;
 u32		audit_sig_sid = 0;
 
 /* Records can be lost in several ways:
-   0) [suppressed in audit_alloc]
+ * 0) [suppressed in audit_alloc]
    1) out of memory in audit_log_start [kmalloc of struct audit_buffer]
    2) out of memory in audit_log_move [alloc_skb]
    3) suppressed due to audit_rate_limit
@@ -132,7 +135,8 @@ struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS];
 
 /* The audit_freelist is a list of pre-allocated audit buffers (if more
  * than AUDIT_MAXFREE are in use, the audit buffer is freed instead of
- * being placed on the freelist). */
+ * being placed on the freelist).
+ */
 static DEFINE_SPINLOCK(audit_freelist_lock);
 static int	   audit_freelist_count;
 static LIST_HEAD(audit_freelist);
@@ -167,18 +171,21 @@ DEFINE_MUTEX(audit_cmd_mutex);
 
 /* AUDIT_BUFSIZ is the size of the temporary buffer used for formatting
  * audit records.  Since printk uses a 1024 byte buffer, this buffer
- * should be at least that large. */
+ * should be at least that large.
+ */
 #define AUDIT_BUFSIZ 1024
 
 /* AUDIT_MAXFREE is the number of empty audit_buffers we keep on the
- * audit_freelist.  Doing so eliminates many kmalloc/kfree calls. */
+ * audit_freelist.  Doing so eliminates many kmalloc/kfree calls.
+ */
 #define AUDIT_MAXFREE  (2*NR_CPUS)
 
 /* The audit_buffer is used when formatting an audit record.  The caller
  * locks briefly to get the record off the freelist or to allocate the
  * buffer, and locks briefly to send the buffer to the netlink layer or
  * to place it on a transmit queue.  Multiple audit_buffers can be in
- * use simultaneously. */
+ * use simultaneously.
+ */
 struct audit_buffer {
 	struct list_head     list;
 	struct sk_buff       *skb;	/* formatted skb ready to send */
@@ -227,7 +234,8 @@ static inline int audit_rate_check(void)
 	unsigned long		elapsed;
 	int			retval	   = 0;
 
-	if (!audit_rate_limit) return 1;
+	if (!audit_rate_limit)
+		return 1;
 
 	spin_lock_irqsave(&lock, flags);
 	if (++messages < audit_rate_limit) {
@@ -253,7 +261,7 @@ static inline int audit_rate_check(void)
  * Emit at least 1 message per second, even if audit_rate_check is
  * throttling.
  * Always increment the lost messages counter.
-*/
+ */
 void audit_log_lost(const char *message)
 {
 	static unsigned long	last_msg = 0;
@@ -350,6 +358,7 @@ static int audit_set_backlog_wait_time(u32 timeout)
 static int audit_set_enabled(u32 state)
 {
 	int rc;
+
 	if (state > AUDIT_LOCKED)
 		return -EINVAL;
 
@@ -402,7 +411,8 @@ static void kauditd_printk_skb(struct sk_buff *skb)
 static void kauditd_hold_skb(struct sk_buff *skb)
 {
 	/* at this point it is uncertain if we will ever send this to auditd so
-	 * try to send the message via printk before we go any further */
+	 * try to send the message via printk before we go any further
+	 */
 	kauditd_printk_skb(skb);
 
 	/* can we just silently drop the message? */
@@ -436,7 +446,8 @@ static void kauditd_retry_skb(struct sk_buff *skb)
 {
 	/* NOTE: because records should only live in the retry queue for a
 	 * short period of time, before either being sent or moved to the hold
-	 * queue, we don't currently enforce a limit on this queue */
+	 * queue, we don't currently enforce a limit on this queue
+	 */
 	skb_queue_tail(&audit_retry_queue, skb);
 }
 
@@ -555,7 +566,7 @@ static int kauditd_thread(void *dummy)
 	struct nlmsghdr *nlh;
 
 #define UNICAST_RETRIES 5
-#define AUDITD_BAD(x,y) \
+#define AUDITD_BAD(x, y) \
 	((x) == -ECONNREFUSED || (x) == -EPERM || ++(y) >= UNICAST_RETRIES)
 
 	/* NOTE: we do invalidate the auditd connection flag on any sending
@@ -729,8 +740,9 @@ static int audit_send_reply_thread(void *arg)
 	mutex_unlock(&audit_cmd_mutex);
 
 	/* Ignore failure. It'll only happen if the sender goes away,
-	   because our timeout is set to infinite. */
-	netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0);
+	 * because our timeout is set to infinite.
+	 */
+	netlink_unicast(aunet->nlsk, reply->skb, reply->portid, 0);
 	put_net(net);
 	kfree(reply);
 	return 0;
@@ -1311,6 +1323,7 @@ static void __net_exit audit_net_exit(struct net *net)
 {
 	struct audit_net *aunet = net_generic(net, audit_net_id);
 	struct sock *sock = aunet->nlsk;
+
 	mutex_lock(&audit_cmd_mutex);
 	if (sock == audit_sock)
 		auditd_reset();
@@ -1378,7 +1391,8 @@ static int __init audit_enable(char *str)
 __setup("audit=", audit_enable);
 
 /* Process kernel command-line parameter at boot time.
- * audit_backlog_limit=<n> */
+ * audit_backlog_limit=<n> 
+ */
 static int __init audit_backlog_limit_set(char *str)
 {
 	u32 audit_backlog_limit_arg;
@@ -1415,7 +1429,7 @@ static void audit_buffer_free(struct audit_buffer *ab)
 	spin_unlock_irqrestore(&audit_freelist_lock, flags);
 }
 
-static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx,
+static struct audit_buffer *audit_buffer_alloc(struct audit_context *ctx,
 						gfp_t gfp_mask, int type)
 {
 	unsigned long flags;
@@ -1921,7 +1935,8 @@ void audit_log_name(struct audit_context *context, struct audit_names *n,
 			break;
 		case 0:
 			/* name was specified as a relative path and the
-			 * directory component is the cwd */
+			 * directory component is the cwd
+			 */
 			audit_log_d_path(ab, " name=", &context->pwd);
 			break;
 		default:
@@ -1961,7 +1976,7 @@ void audit_log_name(struct audit_context *context, struct audit_names *n,
 
 	/* log the audit_names record type */
 	audit_log_format(ab, " nametype=");
-	switch(n->type) {
+	switch (n->type) {
 	case AUDIT_TYPE_NORMAL:
 		audit_log_format(ab, "NORMAL");
 		break;
-- 
2.7.4





More information about the Linux-audit mailing list