All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
Cc: jack@suse.cz, jeffm@suse.com, akpm@linux-foundation.org,
	fabf@skynet.be, rashika.kheria@gmail.com,
	reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu,
	blee@gatech.edu
Subject: Re: [PATCH] reiserfs: kstrdup() memory handling
Date: Sat, 21 Mar 2015 10:15:47 -0700	[thread overview]
Message-ID: <20150321171547.GA5663@thin> (raw)
In-Reply-To: <1426957213-5508-1-git-send-email-sanidhya.gatech@gmail.com>

On Sat, Mar 21, 2015 at 01:00:13PM -0400, Sanidhya Kashyap wrote:
> Checking for ENOMEM even for new_opts in reiserfs_remount function as
> there is a possibility of nothing being allocated.

You don't need to add a new label; kfree(NULL) is a no-op.

> Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
> ---
>  fs/reiserfs/super.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
> index 71fbbe3..bf9bc66 100644
> --- a/fs/reiserfs/super.c
> +++ b/fs/reiserfs/super.c
> @@ -1397,6 +1397,11 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
>  	int i;
>  #endif
>  
> +	if (!new_opts) {
> +		err = -ENOMEM;
> +		goto out_err_no_kfree;
> +	}
> +
>  	sync_filesystem(s);
>  	reiserfs_write_lock(s);
>  
> @@ -1549,6 +1554,7 @@ out_err_unlock:
>  	reiserfs_write_unlock(s);
>  out_err:
>  	kfree(new_opts);
> +out_err_no_kfree:
>  	return err;
>  }
>  
> -- 
> 2.1.0
> 

  reply	other threads:[~2015-03-21 17:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21 17:00 [PATCH] reiserfs: kstrdup() memory handling Sanidhya Kashyap
2015-03-21 17:15 ` Josh Triplett [this message]
2015-03-23  0:12   ` Sanidhya Kashyap
2015-03-23  2:55     ` Josh Triplett

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=20150321171547.GA5663@thin \
    --to=josh@joshtriplett.org \
    --cc=akpm@linux-foundation.org \
    --cc=blee@gatech.edu \
    --cc=changwoo@gatech.edu \
    --cc=fabf@skynet.be \
    --cc=jack@suse.cz \
    --cc=jeffm@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rashika.kheria@gmail.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=sanidhya.gatech@gmail.com \
    --cc=sanidhya@gatech.edu \
    --cc=taesoo@gatech.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.