All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: wzt.wzt@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-audit@redhat.com
Subject: Re: [PATCH] Kernel: Fix coding style in kernel/audit.c
Date: Mon, 08 Mar 2010 15:56:03 -0500	[thread overview]
Message-ID: <1268081763.3227.6.camel@localhost> (raw)
In-Reply-To: <20100308222742.GB17489@localhost.localdomain>

On Tue, 2010-03-09 at 06:27 +0800, wzt.wzt@gmail.com wrote:
> Fix coding style in kernel/audit.c
> 
> Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>

NAK.  I think you need to figure out if() statements before you try more
coding style cleanups....

-Eric


> 
> ---
>  kernel/audit.c |   22 +++++++++++-----------
>  1 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 5feed23..5164696 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -331,12 +331,12 @@ static int audit_set_backlog_limit(int limit, uid_t loginuid, u32 sessionid,
>  static int audit_set_enabled(int state, uid_t loginuid, u32 sessionid, u32 sid)
>  {
>  	int rc;
> +
>  	if (state < AUDIT_OFF || state > AUDIT_LOCKED)
>  		return -EINVAL;
>  
>  	rc =  audit_do_config_change("audit_enabled", &audit_enabled, state,
>  				     loginuid, sessionid, sid);
> -
>  	if (!rc)
>  		audit_ever_enabled |= !!state;
>  
> @@ -346,8 +346,8 @@ static int audit_set_enabled(int state, uid_t loginuid, u32 sessionid, u32 sid)
>  static int audit_set_failure(int state, uid_t loginuid, u32 sessionid, u32 sid)
>  {
>  	if (state != AUDIT_FAIL_SILENT
> -	    && state != AUDIT_FAIL_PRINTK
> -	    && state != AUDIT_FAIL_PANIC)
> +		&& state != AUDIT_FAIL_PRINTK
> +		&& state != AUDIT_FAIL_PANIC)
>  		return -EINVAL;
>  
>  	return audit_do_config_change("audit_failure", &audit_failure, state,
> @@ -366,7 +366,7 @@ static int audit_set_failure(int state, uid_t loginuid, u32 sessionid, u32 sid)
>  static void audit_hold_skb(struct sk_buff *skb)
>  {
>  	if (audit_default &&
> -	    skb_queue_len(&audit_skb_hold_queue) < audit_backlog_limit)
> +		skb_queue_len(&audit_skb_hold_queue) < audit_backlog_limit)
>  		skb_queue_tail(&audit_skb_hold_queue, skb);
>  	else
>  		kfree_skb(skb);
> @@ -1163,9 +1163,9 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
>  				entries over the normal backlog limit */
>  
>  	while (audit_backlog_limit
> -	       && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) {
> +		&& skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) {
>  		if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time
> -		    && time_before(jiffies, timeout_start + audit_backlog_wait_time)) {
> +			&& time_before(jiffies, timeout_start + audit_backlog_wait_time)) {
>  
>  			/* Wait for auditd to drain the queue a little */
>  			DECLARE_WAITQUEUE(wait, current);
> @@ -1173,7 +1173,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
>  			add_wait_queue(&audit_backlog_wait, &wait);
>  
>  			if (audit_backlog_limit &&
> -			    skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
> +				skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
>  				schedule_timeout(timeout_start + audit_backlog_wait_time - jiffies);
>  
>  			__set_current_state(TASK_RUNNING);
> @@ -1316,18 +1316,18 @@ void audit_log_n_hex(struct audit_buffer *ab, const unsigned char *buf,
>  	BUG_ON(!ab->skb);
>  	skb = ab->skb;
>  	avail = skb_tailroom(skb);
> -	new_len = len<<1;
> +	new_len = len << 1;
>  	if (new_len >= avail) {
>  		/* Round the buffer request up to the next multiple */
> -		new_len = AUDIT_BUFSIZ*(((new_len-avail)/AUDIT_BUFSIZ) + 1);
> +		new_len = AUDIT_BUFSIZ * (((new_len - avail) / AUDIT_BUFSIZ) + 1);
>  		avail = audit_expand(ab, new_len);
>  		if (!avail)
>  			return;
>  	}
>  
>  	ptr = skb_tail_pointer(skb);
> -	for (i=0; i<len; i++) {
> -		*ptr++ = hex[(buf[i] & 0xF0)>>4]; /* Upper nibble */
> +	for (i = 0; i < len; i++) {
> +		*ptr++ = hex[(buf[i] & 0xF0) >> 4]; /* Upper nibble */
>  		*ptr++ = hex[buf[i] & 0x0F];	  /* Lower nibble */
>  	}
>  	*ptr = 0;

      parent reply	other threads:[~2010-03-08 20:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08 22:27 [PATCH] Kernel: Fix coding style in kernel/audit.c wzt.wzt
2010-03-08 15:16 ` Alexey Dobriyan
2010-03-08 20:44 ` Al Viro
2010-03-08 20:56 ` Eric Paris [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268081763.3227.6.camel@localhost \
    --to=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wzt.wzt@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.