Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1273494 > unrolled thread

Re: [PATCH] kernel-audit: Delete unnecessary checks before two function calls

Started byPaul Moore <paul@paul-moore.com>
First post2015-11-19 22:00 +0100
Last post2015-11-19 22:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] kernel-audit: Delete unnecessary checks before two function calls Paul Moore <paul@paul-moore.com> - 2015-11-19 22:00 +0100

#1273494 — Re: [PATCH] kernel-audit: Delete unnecessary checks before two function calls

FromPaul Moore <paul@paul-moore.com>
Date2015-11-19 22:00 +0100
SubjectRe: [PATCH] kernel-audit: Delete unnecessary checks before two function calls
Message-ID<qwEtb-5WV-1@gated-at.bofh.it>
On Sunday, November 15, 2015 12:42:52 PM SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 15 Nov 2015 12:38:33 +0100
> 
> The functions consume_skb() and kfree_skb() test whether their argument
> is NULL and then return immediately.
> Thus the tests around their calls are not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  kernel/audit.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Merged, thanks.

> diff --git a/kernel/audit.c b/kernel/audit.c
> index 5ffcbd3..1e8e228 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -509,8 +509,7 @@ static void flush_hold_queue(void)
>  	 * if auditd just disappeared but we
>  	 * dequeued an skb we need to drop ref
>  	 */
> -	if (skb)
> -		consume_skb(skb);
> +	consume_skb(skb);
>  }
> 
>  static int kauditd_thread(void *dummy)
> @@ -1232,9 +1231,7 @@ static void audit_buffer_free(struct audit_buffer *ab)
> if (!ab)
>  		return;
> 
> -	if (ab->skb)
> -		kfree_skb(ab->skb);
> -
> +	kfree_skb(ab->skb);
>  	spin_lock_irqsave(&audit_freelist_lock, flags);
>  	if (audit_freelist_count > AUDIT_MAXFREE)
>  		kfree(ab);

-- 
paul moore
www.paul-moore.com

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web