mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: linux@horizon.com
To: linux-kernel@vger.kernel.org
Cc: kernel@linuxace.com
Subject: Re: [PATCH] Document kfree and vfree NULL usage
Date: 27 Nov 2004 22:17:20 -0000	[thread overview]
Message-ID: <20041127221720.16853.qmail@science.horizon.com> (raw)

>> -	if (mfile) {
>> -		kfree(mfile);
>> -	} else {
>> +	kfree(mfile);
>> +	if (!mfile) {
>>  		snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
>>  		return -ENOENT;
>>  	}

> The above change seems to always trigger the ENOENT return, no?

No.  kfree(mfile) doesn't magically change the numerical value of mfile.
Dereferencing it now would be a bad idea, but you can still look at it.

(The ANSI C standard envisions architectures on which just *looking* at
a dangling pointer is illegal, but Linux makes slightly tighter
restrictions.)

             reply	other threads:[~2004-11-27 22:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-27 22:17 linux [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-27 14:26 Pekka Enberg
2004-11-27 17:13 ` Marcel Sebek
2004-11-27 19:30   ` Pekka Enberg
2004-11-27 20:43     ` Marcel Sebek
2004-11-27 21:23       ` Phil Oester
2004-11-28  8:05         ` Pekka Enberg
2004-11-28  9:04           ` Marcel Sebek
2004-11-27 23:58   ` Tomas Carnecky
2004-11-28  0:17     ` Nick Piggin
2004-11-28  8:20       ` Pekka Enberg
2004-11-27 23:39 ` John Levon
2004-11-28  8:00   ` Pekka Enberg

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=20041127221720.16853.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=kernel@linuxace.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

all inboxes | Powered by JetHome®