From: Jesper Juhl <juhl-lkml@dif.dk>
To: David Howells <dhowells@redhat.com>
Cc: Jesper Juhl <juhl-lkml@dif.dk>,
linux-kernel <linux-kernel@vger.kernel.org>,
Stephen Smalley <sds@epoch.ncsc.mil>,
Chris Vance <cvance@nai.com>, Wayne Salamon <wsalamon@nai.com>,
James Morris <jmorris@redhat.com>,
dgoeddel@trustedcs.com, Karl MacMillan <kmacmillan@tresys.com>,
Frank Mayer <mayerf@tresys.com>,
selinux@tycho.nsa.gov, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/
Date: Tue, 22 Mar 2005 21:46:01 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.62.0503222141540.2683@dragon.hyggekrogen.localhost> (raw)
In-Reply-To: <9581.1111505666@redhat.com>
On Tue, 22 Mar 2005, David Howells wrote:
>
> Jesper Juhl <juhl-lkml@dif.dk> wrote:
>
> > --- linux-2.6.11-mm4-orig/security/keys/key.c 2005-03-16 15:45:42.000000000 +0100
> > +++ linux-2.6.11-mm4/security/keys/key.c 2005-03-20 12:40:19.000000000 +0100
> > ...
> > - if (candidate)
> > - kfree(candidate);
> > + kfree(candidate);
>
> Looks okay to me. It's probably less efficient though, but more space
> efficient.
>
>From looking at the code gcc generates it looks to me like the bennefits
of the smaller code should outweigh the overhead of a few more function
calls - especially if the branch is usually taken (which I must admit I
can't really tell if it will be). If the branch is rarely taken you are
probably right.
> > --- linux-2.6.11-mm4-orig/security/keys/user_defined.c 2005-03-16 15:45:42.000000000 +0100
> > +++ linux-2.6.11-mm4/security/keys/user_defined.c 2005-03-20 12:41:54.000000000 +0100
> > @@ -182,9 +182,7 @@ static int user_match(const struct key *
> > */
> > static void user_destroy(struct key *key)
> > {
> > - struct user_key_payload *upayload = key->payload.data;
> > -
> > - kfree(upayload);
> > + kfree(key->payload.data);
>
> There's a patch in Andrew Morton's tree that changes this to make use of RCU,
> so I'd prefer you didn't do this just yet.
>
Huh? I just checked 2.6.12-rc1-mm1, and the user_destroy function still
looks as above... But no problem, I'll just send Andrew the bits in
security/selinux/ for now and wait a bit with the rest.
Thank you for your comments.
--
Jesper
next prev parent reply other threads:[~2005-03-22 20:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-20 12:29 Jesper Juhl
2005-03-20 12:50 ` Ralph Corderoy
2005-03-20 13:18 ` Jesper Juhl
2005-03-20 13:31 ` Ralph Corderoy
2005-03-20 14:04 ` YOSHIFUJI Hideaki / 吉藤英明
2005-03-20 14:39 ` Jesper Juhl
2005-03-21 10:17 ` Ralph Corderoy
2005-03-22 15:00 ` Stephen Smalley
2005-03-22 20:57 ` [PATCH] don't do pointless NULL checks and casts before kfree() in security/selinux/ Jesper Juhl
2005-03-22 15:34 ` [PATCH] don't do pointless NULL checks and casts before kfree() in security/ David Howells
2005-03-22 20:46 ` Jesper Juhl [this message]
[not found] <fa.p25ihnj.4026at@ifi.uio.no>
[not found] ` <fa.iqmuavi.o6kfai@ifi.uio.no>
2005-03-20 13:18 ` Bodo Eggert
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=Pine.LNX.4.62.0503222141540.2683@dragon.hyggekrogen.localhost \
--to=juhl-lkml@dif.dk \
--cc=akpm@osdl.org \
--cc=cvance@nai.com \
--cc=dgoeddel@trustedcs.com \
--cc=dhowells@redhat.com \
--cc=jmorris@redhat.com \
--cc=kmacmillan@tresys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mayerf@tresys.com \
--cc=sds@epoch.ncsc.mil \
--cc=selinux@tycho.nsa.gov \
--cc=wsalamon@nai.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®