Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Jan Engelhardt
On Jan 1 2007 22:40, Ingo Oeser wrote: >On Monday, 1. January 2007 17:25, Andreas Schwab wrote: >> Ingo Oeser <[EMAIL PROTECTED]> writes: >> > Then this works, because the side effect (+20) is evaluated only once. >> >> It's not a side effect, it's a non-lvalue, and you can't take the address

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Ingo Oeser
On Monday, 1. January 2007 17:25, Andreas Schwab wrote: > Ingo Oeser <[EMAIL PROTECTED]> writes: > > Then this works, because the side effect (+20) is evaluated only once. > > It's not a side effect, it's a non-lvalue, and you can't take the address > of a non-lvalue. Just verified this. So If

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Pavel Machek
Hi! > > I decided to keep it simple. If someone is calling kfree_nullify() with > > anything other than a > > simple variable, then they should call kfree(). > > kfree_nullify() has to replace kfree() to be of any use one day. So this is > not an option. > Doing kfree() that writes to its

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Andreas Schwab
Ingo Oeser <[EMAIL PROTECTED]> writes: > Hi, > > On Monday, 1. January 2007 07:37, Amit Choudhary wrote: >> --- Ingo Oeser <[EMAIL PROTECTED]> wrote: >> > #define kfree_nullify(x) do { \ >> >if (__builtin_constant_p(x)) { \ >> >kfree(x); \ >> >} else { \ >> >

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Ingo Oeser
Hi, On Monday, 1. January 2007 07:37, Amit Choudhary wrote: > --- Ingo Oeser <[EMAIL PROTECTED]> wrote: > > #define kfree_nullify(x) do { \ > > if (__builtin_constant_p(x)) { \ > > kfree(x); \ > > } else { \ > > typeof(x) *__addr_x = \ Ok, I should change that

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Ingo Oeser
Hi, On Monday, 1. January 2007 07:37, Amit Choudhary wrote: --- Ingo Oeser [EMAIL PROTECTED] wrote: #define kfree_nullify(x) do { \ if (__builtin_constant_p(x)) { \ kfree(x); \ } else { \ typeof(x) *__addr_x = x; \ Ok, I should change that line to

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Andreas Schwab
Ingo Oeser [EMAIL PROTECTED] writes: Hi, On Monday, 1. January 2007 07:37, Amit Choudhary wrote: --- Ingo Oeser [EMAIL PROTECTED] wrote: #define kfree_nullify(x) do { \ if (__builtin_constant_p(x)) { \ kfree(x); \ } else { \ typeof(x) *__addr_x = x; \

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Pavel Machek
Hi! I decided to keep it simple. If someone is calling kfree_nullify() with anything other than a simple variable, then they should call kfree(). kfree_nullify() has to replace kfree() to be of any use one day. So this is not an option. Doing kfree() that writes to its argument is

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Ingo Oeser
On Monday, 1. January 2007 17:25, Andreas Schwab wrote: Ingo Oeser [EMAIL PROTECTED] writes: Then this works, because the side effect (+20) is evaluated only once. It's not a side effect, it's a non-lvalue, and you can't take the address of a non-lvalue. Just verified this. So If we

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2007-01-01 Thread Jan Engelhardt
On Jan 1 2007 22:40, Ingo Oeser wrote: On Monday, 1. January 2007 17:25, Andreas Schwab wrote: Ingo Oeser [EMAIL PROTECTED] writes: Then this works, because the side effect (+20) is evaluated only once. It's not a side effect, it's a non-lvalue, and you can't take the address of a

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread Amit Choudhary
--- Ingo Oeser <[EMAIL PROTECTED]> wrote: > On Sunday, 31. December 2006 14:38, Bernd Petrovitsch wrote: > > That depends on the decision/definition if (so called) "double free" is > > an error or not (and "free(NULL)" must work in POSIX-compliant > > environments). > > A double free of

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Mon, 1 Jan 2007 01:43:00 +0100), Ingo Oeser <[EMAIL PROTECTED]> says: > On Sunday, 31. December 2006 14:38, Bernd Petrovitsch wrote: > > That depends on the decision/definition if (so called) "double free" is > > an error or not (and "free(NULL)" must work in

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread Ingo Oeser
On Sunday, 31. December 2006 14:38, Bernd Petrovitsch wrote: > That depends on the decision/definition if (so called) "double free" is > an error or not (and "free(NULL)" must work in POSIX-compliant > environments). A double free of non-NULL is certainly an error. So the idea of setting it to

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread Bernd Petrovitsch
On Thu, 2006-12-28 at 09:54 +0100, Jan Engelhardt wrote: > On Dec 27 2006 17:10, Pavel Machek wrote: > > >> Was just wondering if the _var_ in kfree(_var_) could be set to > >> NULL after its freed. It may solve the problem of accessing some > >> freed memory as the kernel will crash since _var_

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread Bernd Petrovitsch
On Thu, 2006-12-28 at 09:54 +0100, Jan Engelhardt wrote: On Dec 27 2006 17:10, Pavel Machek wrote: Was just wondering if the _var_ in kfree(_var_) could be set to NULL after its freed. It may solve the problem of accessing some freed memory as the kernel will crash since _var_ was set to

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread Ingo Oeser
On Sunday, 31. December 2006 14:38, Bernd Petrovitsch wrote: That depends on the decision/definition if (so called) double free is an error or not (and free(NULL) must work in POSIX-compliant environments). A double free of non-NULL is certainly an error. So the idea of setting it to NULL is

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Mon, 1 Jan 2007 01:43:00 +0100), Ingo Oeser [EMAIL PROTECTED] says: On Sunday, 31. December 2006 14:38, Bernd Petrovitsch wrote: That depends on the decision/definition if (so called) double free is an error or not (and free(NULL) must work in

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-31 Thread Amit Choudhary
--- Ingo Oeser [EMAIL PROTECTED] wrote: On Sunday, 31. December 2006 14:38, Bernd Petrovitsch wrote: That depends on the decision/definition if (so called) double free is an error or not (and free(NULL) must work in POSIX-compliant environments). A double free of non-NULL is certainly

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-28 Thread Jan Engelhardt
On Dec 27 2006 17:10, Pavel Machek wrote: >> Was just wondering if the _var_ in kfree(_var_) could be set to >> NULL after its freed. It may solve the problem of accessing some >> freed memory as the kernel will crash since _var_ was set to NULL. >> >> Does this make sense? If yes, then how

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-28 Thread Pavel Machek
Hi! > Was just wondering if the _var_ in kfree(_var_) could be set to NULL after > its freed. It may solve > the problem of accessing some freed memory as the kernel will crash since > _var_ was set to NULL. > > Does this make sense? If yes, then how about renaming kfree to something else >

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-28 Thread Pavel Machek
Hi! Was just wondering if the _var_ in kfree(_var_) could be set to NULL after its freed. It may solve the problem of accessing some freed memory as the kernel will crash since _var_ was set to NULL. Does this make sense? If yes, then how about renaming kfree to something else and

Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-28 Thread Jan Engelhardt
On Dec 27 2006 17:10, Pavel Machek wrote: Was just wondering if the _var_ in kfree(_var_) could be set to NULL after its freed. It may solve the problem of accessing some freed memory as the kernel will crash since _var_ was set to NULL. Does this make sense? If yes, then how about

[PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-21 Thread Amit Choudhary
Hi, Was just wondering if the _var_ in kfree(_var_) could be set to NULL after its freed. It may solve the problem of accessing some freed memory as the kernel will crash since _var_ was set to NULL. Does this make sense? If yes, then how about renaming kfree to something else and providing a

[PATCH] [DISCUSS] Make the variable NULL after freeing it.

2006-12-21 Thread Amit Choudhary
Hi, Was just wondering if the _var_ in kfree(_var_) could be set to NULL after its freed. It may solve the problem of accessing some freed memory as the kernel will crash since _var_ was set to NULL. Does this make sense? If yes, then how about renaming kfree to something else and providing a