From: Pavel Machek <pavel@ucw.cz>
To: Amit Choudhary <amit2030@yahoo.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [DISCUSS] Make the variable NULL after freeing it.
Date: Wed, 27 Dec 2006 17:10:11 +0000 [thread overview]
Message-ID: <20061227171010.GA4088@ucw.cz> (raw)
In-Reply-To: <20061221234127.29189.qmail@web55606.mail.re4.yahoo.com>
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
> kfree macro that would do the following:
>
> #define kfree(x) do { \
> new_kfree(x); \
> x = NULL; \
> } while(0)
>
> There might be other better ways too.
No, that would be very confusing. Otoh having
KFREE() do kfree() and assignment might be acceptable.
Pavel
--
Thanks for all the (sleeping) penguins.
next prev parent reply other threads:[~2006-12-28 8:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-21 23:41 [PATCH] [DISCUSS] Make the variable NULL after freeing it Amit Choudhary
2006-12-27 17:10 ` Pavel Machek [this message]
2006-12-28 8:54 ` Jan Engelhardt
2006-12-31 13:38 ` Bernd Petrovitsch
2007-01-01 0:43 ` Ingo Oeser
2007-01-01 1:05 ` YOSHIFUJI Hideaki / 吉藤英明
2007-01-01 6:37 ` Amit Choudhary
2007-01-01 16:09 ` Ingo Oeser
2007-01-01 16:25 ` Andreas Schwab
2007-01-01 21:40 ` Ingo Oeser
2007-01-01 21:42 ` Jan Engelhardt
2007-01-01 18:36 ` Pavel Machek
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=20061227171010.GA4088@ucw.cz \
--to=pavel@ucw.cz \
--cc=amit2030@yahoo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox