public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Raja R Harinath <harinath@cs.umn.edu>
To: Zwane Mwaikambo <zwane@linux.realnet.co.sz>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>, <sct@redhat.com>
Subject: Re: [PATCH] if (foo) kfree(foo) /fs cleanup + reverted JBD code path changes
Date: Sat, 01 Dec 2001 14:40:58 -0600	[thread overview]
Message-ID: <d9snau4qsl.fsf@han.cs.umn.edu> (raw)
In-Reply-To: <Pine.LNX.4.33.0112011830550.14290-100000@netfinity.realnet.co.sz>
In-Reply-To: <Pine.LNX.4.33.0112011830550.14290-100000@netfinity.realnet.co.sz> (Zwane Mwaikambo's message of "Sat, 1 Dec 2001 18:33:50 +0200 (SAST)")

Zwane Mwaikambo <zwane@linux.realnet.co.sz> writes:

> diff -urN linux-2.5.1-pre4.orig/fs/coda/inode.c linux-2.5.1-pre4.kfree/fs/coda/inode.c
> --- linux-2.5.1-pre4.orig/fs/coda/inode.c	Fri Apr 27 23:09:37 2001
> +++ linux-2.5.1-pre4.kfree/fs/coda/inode.c	Fri Nov 30 23:45:08 2001
> @@ -164,11 +164,10 @@
>
>   error:
>  	EXIT;
> -	if (sbi) {
> -		kfree(sbi);
> -		if(vc)
> -			vc->vc_sb = NULL;
> -	}
> +	kfree(sbi);
> +	if (vc)
> +		vc->vc_sb = NULL;
> +
>  	if (root)
>                  iput(root);

Not a safe change.  If you really really really want to change it, it
should be

        if (sbi && vc)
		vc->vc_sb = NULL;
        kfree(sbi);

Then, the maintainer of the code can decide if that's what he meant.

> -	if (opts.iocharset) {
> -		printk("FAT: freeing iocharset=%s\n", opts.iocharset);
> -		kfree(opts.iocharset);
> -	}
> -	if(sbi->private_data)
> -		kfree(sbi->private_data);
> +	printk("FAT: freeing iocharset=%s\n", opts.iocharset);
> +	kfree(opts.iocharset);

And, you get a Oops in 'printk' in the bargain.  The following is
better, but doesn't really buy you much.

	if (opts.iocharset) 
		printk("FAT: freeing iocharset=%s\n", opts.iocharset);
        kfree(opts.iocharset);

>  		printk("jffs_find_child(): Didn't find the file \"%s\".\n",
>  		       (copy ? copy : ""));
> -		if (copy) {
> -			kfree(copy);
> +		kfree(copy);
>  		}
                ^
Missed the closing brace.

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash

  parent reply	other threads:[~2001-12-01 20:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-01 11:36 [PATCH] if (foo) kfree(foo) /fs cleanup Zwane Mwaikambo
2001-12-01 12:45 ` Alan Cox
2001-12-01 12:49   ` Jeff Garzik
2001-12-01 13:10   ` Zwane Mwaikambo
2001-12-01 16:33 ` [PATCH] if (foo) kfree(foo) /fs cleanup + reverted JBD code path changes Zwane Mwaikambo
2001-12-01 17:14   ` OGAWA Hirofumi
2001-12-01 17:48     ` Zwane Mwaikambo
2001-12-01 18:05       ` OGAWA Hirofumi
2001-12-01 18:13         ` Zwane Mwaikambo
     [not found]   ` <Pine.LNX.4.33.0112011830550.14290-100000@netfinity.realnet.co.s z>
2001-12-01 17:40     ` Alex Bligh - linux-kernel
2001-12-01 18:02       ` Zwane Mwaikambo
2001-12-01 18:11       ` Zwane Mwaikambo
2001-12-01 20:40   ` Raja R Harinath [this message]
2001-12-01 21:25     ` Francois Romieu

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=d9snau4qsl.fsf@han.cs.umn.edu \
    --to=harinath@cs.umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    --cc=zwane@linux.realnet.co.sz \
    /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