All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: Jesper Juhl <juhl-lkml@dif.dk>
Cc: linux-kernel@vger.kernel.org,
	"Rickard E. (Rik) Faith" <faith@redhat.com>,
	Rik Faith <faith@cs.unc.edu>,
	linux-audit@redhat.com
Subject: Re: [PATCH] Small kfree cleanup, save a local variable.
Date: Sun, 19 Jun 2005 13:13:54 -0700	[thread overview]
Message-ID: <20050619201354.GY9153@shell0.pdx.osdl.net> (raw)
In-Reply-To: <Pine.LNX.4.62.0506192129300.2832@dragon.hyggekrogen.localhost>

* Jesper Juhl (juhl-lkml@dif.dk) wrote:
> Here's a patch with a small improvement to kernel/auditsc.c .
> There's no need for the local variable  struct audit_entry *e  , 
> we can just call kfree directly on container_of() .
> Patch also removes an extra space a little further down in the file.

Please Cc: linux-audit@redhat.com on audit patches.  I tend to agree
with Michael, it's optimized away, and readable as is.

thanks,
-chris

> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
> ---
> 
>  kernel/auditsc.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> --- linux-2.6.12-orig/kernel/auditsc.c	2005-06-17 21:48:29.000000000 +0200
> +++ linux-2.6.12/kernel/auditsc.c	2005-06-19 21:21:37.000000000 +0200
> @@ -202,8 +202,7 @@ static inline int audit_add_rule(struct 
>  
>  static void audit_free_rule(struct rcu_head *head)
>  {
> -	struct audit_entry *e = container_of(head, struct audit_entry, rcu);
> -	kfree(e);
> +	kfree(container_of(head, struct audit_entry, rcu));
>  }
>  
>  /* Note that audit_add_rule and audit_del_rule are called via
> @@ -612,7 +611,7 @@ static inline void audit_free_context(st
>  		audit_free_names(context);
>  		audit_free_aux(context);
>  		kfree(context);
> -		context  = previous;
> +		context = previous;
>  	} while (context);
>  	if (count >= 10)
>  		printk(KERN_ERR "audit: freed %d contexts\n", count);

  parent reply	other threads:[~2005-06-19 20:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-19 19:38 [PATCH] Small kfree cleanup, save a local variable Jesper Juhl
2005-06-19 19:37 ` Michael Buesch
2005-06-19 19:49   ` Jesper Juhl
2005-06-19 20:13 ` Chris Wright [this message]
2005-06-19 20:19   ` Jesper Juhl
2005-06-19 20:20     ` Chris Wright

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=20050619201354.GY9153@shell0.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=faith@cs.unc.edu \
    --cc=faith@redhat.com \
    --cc=juhl-lkml@dif.dk \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.