Re: [PATCH] include/linux/slab.h: new KFREE() macro.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- [email protected] wrote:

> On Tue, 09 Jan 2007 11:02:35 PST, Amit Choudhary said:
> > Correct. And doing kfree(x); x=NULL; is not hiding that. These issues can still be debugged by
> > using the slab debugging options. One other benefit of doing this is that if someone tries to
> > access the same memory again using the variable 'x', then he will get an immediate crash.


What did you understand when I wrote that "if you access the same memory again using the variable
'x"?

Using variable 'x' means using variable 'x' and not variable 'y'.


 And
> the
> > problem can be solved immediately, without using the slab debugging options. I do not yet
> > understand how doing this hides the bugs, obfuscates the code, etc. because I haven't seen an
> > example yet, but only blanket statements.
> 
> char *broken() {
> 	char *x, *y;
> 	x = kmalloc(100);
> 	y = x;
> 	kfree(x);
> 	x = NULL;
> 	return y;
> }
> 
> Setting x to NULL doesn't do anything to fix the *real* bug here, because
> the problematic reference is held in y, not x.  


Did I ever say that it fixes that kind of bug?


>So you never get a crash
> because somebody dereferences x.
> 


Dereferencing 'x' means dereferencing 'x' and not dereferencing 'y'.

-Amit

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux