Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/selinux/

2005-03-22 Thread Jesper Juhl
Andrew, as pr Stephen's comment below I'm sending you a diff that's a subset of the kfree() fixes i did for security/ earlier. The patch below contains only the bits from security/selinux/ that Stephen ACK'ed - re-diff'ed against 2.6.12-rc1-mm1. Please consider applying. On Tue, 22 Mar 2005,

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-22 Thread Jesper Juhl
On Tue, 22 Mar 2005, David Howells wrote: > > Jesper Juhl <[EMAIL PROTECTED]> wrote: > > > --- linux-2.6.11-mm4-orig/security/keys/key.c 2005-03-16 > > 15:45:42.0 +0100 > > +++ linux-2.6.11-mm4/security/keys/key.c2005-03-20 12:40:19.0 > > +0100 > > ... > > - if

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-22 Thread David Howells
Jesper Juhl <[EMAIL PROTECTED]> wrote: > --- linux-2.6.11-mm4-orig/security/keys/key.c 2005-03-16 15:45:42.0 > +0100 > +++ linux-2.6.11-mm4/security/keys/key.c 2005-03-20 12:40:19.0 > +0100 > ... > - if (candidate) > - kfree(candidate); > +

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-22 Thread Stephen Smalley
On Sun, 2005-03-20 at 13:29 +0100, Jesper Juhl wrote: > kfree() handles NULL pointers, so checking a pointer for NULL before > calling kfree() on it is pointless. kfree() takes a void* argument and > changing the type of a pointer before kfree()'ing it is equally pointless. > This patch removes

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-22 Thread Stephen Smalley
On Sun, 2005-03-20 at 13:29 +0100, Jesper Juhl wrote: kfree() handles NULL pointers, so checking a pointer for NULL before calling kfree() on it is pointless. kfree() takes a void* argument and changing the type of a pointer before kfree()'ing it is equally pointless. This patch removes the

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-22 Thread David Howells
Jesper Juhl [EMAIL PROTECTED] wrote: --- linux-2.6.11-mm4-orig/security/keys/key.c 2005-03-16 15:45:42.0 +0100 +++ linux-2.6.11-mm4/security/keys/key.c 2005-03-20 12:40:19.0 +0100 ... - if (candidate) - kfree(candidate); + kfree(candidate);

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-22 Thread Jesper Juhl
On Tue, 22 Mar 2005, David Howells wrote: Jesper Juhl [EMAIL PROTECTED] wrote: --- linux-2.6.11-mm4-orig/security/keys/key.c 2005-03-16 15:45:42.0 +0100 +++ linux-2.6.11-mm4/security/keys/key.c2005-03-20 12:40:19.0 +0100 ... - if (candidate) -

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/selinux/

2005-03-22 Thread Jesper Juhl
Andrew, as pr Stephen's comment below I'm sending you a diff that's a subset of the kfree() fixes i did for security/ earlier. The patch below contains only the bits from security/selinux/ that Stephen ACK'ed - re-diff'ed against 2.6.12-rc1-mm1. Please consider applying. On Tue, 22 Mar 2005,

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-21 Thread Ralph Corderoy
Hi Jesper, > > > the short version also have the real bennefits of generating > > > shorter and faster code as well as being shorter "on-screen". > > > > Faster code? I'd have thought avoiding the function call outweighed > > the overhead of checking before calling. > > I haven't actually

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-21 Thread Ralph Corderoy
Hi Jesper, the short version also have the real bennefits of generating shorter and faster code as well as being shorter on-screen. Faster code? I'd have thought avoiding the function call outweighed the overhead of checking before calling. I haven't actually measured it, but

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Jesper Juhl
On Sun, 20 Mar 2005, Ralph Corderoy wrote: > > > and if there are places where it's important to remember that the > > pointer might be NULL, then a simple comment would do, wouldn't it? > > > > kfree(foo->bar);/* kfree(NULL) is valid */ > > I'd rather be without the same comment

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Sun, 20 Mar 2005 13:31:43 +), Ralph Corderoy <[EMAIL PROTECTED]> says: > > the short version also have the real bennefits of generating shorter > > and faster code as well as being shorter "on-screen". > > Faster code? I'd have thought avoiding the

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Ralph Corderoy
Hi Jesper, > > Not necessarily. It helps tell the reader that the pointer may be > > NULL at that point. This has come up before. > > > > > > http://groups-beta.google.com/group/linux.kernel/browse_thread/thread/bd3d6e5a29e43c73/[EMAIL > > PROTECTED] > > > > I agree that > > if

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Jesper Juhl
On Sun, 20 Mar 2005, Ralph Corderoy wrote: > > Hi Jesper, > > > kfree() handles NULL pointers, so checking a pointer for NULL before > > calling kfree() on it is pointless. > > Not necessarily. It helps tell the reader that the pointer may be NULL > at that point. This has come up before. >

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Bodo Eggert
Ralph Corderoy <[EMAIL PROTECTED]> wrote: > Hi Jesper, >> kfree() handles NULL pointers, so checking a pointer for NULL before >> calling kfree() on it is pointless. > > Not necessarily. It helps tell the reader that the pointer may be NULL > at that point. This has come up before. If you

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Ralph Corderoy
Hi Jesper, > kfree() handles NULL pointers, so checking a pointer for NULL before > calling kfree() on it is pointless. Not necessarily. It helps tell the reader that the pointer may be NULL at that point. This has come up before.

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Ralph Corderoy
Hi Jesper, kfree() handles NULL pointers, so checking a pointer for NULL before calling kfree() on it is pointless. Not necessarily. It helps tell the reader that the pointer may be NULL at that point. This has come up before.

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Bodo Eggert
Ralph Corderoy [EMAIL PROTECTED] wrote: Hi Jesper, kfree() handles NULL pointers, so checking a pointer for NULL before calling kfree() on it is pointless. Not necessarily. It helps tell the reader that the pointer may be NULL at that point. This has come up before. If you want to

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Jesper Juhl
On Sun, 20 Mar 2005, Ralph Corderoy wrote: Hi Jesper, kfree() handles NULL pointers, so checking a pointer for NULL before calling kfree() on it is pointless. Not necessarily. It helps tell the reader that the pointer may be NULL at that point. This has come up before.

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Ralph Corderoy
Hi Jesper, Not necessarily. It helps tell the reader that the pointer may be NULL at that point. This has come up before. http://groups-beta.google.com/group/linux.kernel/browse_thread/thread/bd3d6e5a29e43c73/[EMAIL PROTECTED] I agree that if (foo-bar) {

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Sun, 20 Mar 2005 13:31:43 +), Ralph Corderoy [EMAIL PROTECTED] says: the short version also have the real bennefits of generating shorter and faster code as well as being shorter on-screen. Faster code? I'd have thought avoiding the function call

Re: [PATCH] don't do pointless NULL checks and casts before kfree() in security/

2005-03-20 Thread Jesper Juhl
On Sun, 20 Mar 2005, Ralph Corderoy wrote: and if there are places where it's important to remember that the pointer might be NULL, then a simple comment would do, wouldn't it? kfree(foo-bar);/* kfree(NULL) is valid */ I'd rather be without the same comment littering the