reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
To: jack@suse.cz, jeffm@suse.com, akpm@linux-foundation.org,
	fabf@skynet.be, josh@joshtriplett.org, rashika.kheria@gmail.com,
	reiserfs-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu,
	blee@gatech.edu, Sanidhya Kashyap <sanidhya.gatech@gmail.com>
Subject: [PATCH] reiserfs: kstrdup() memory handling
Date: Sat, 21 Mar 2015 13:00:13 -0400	[thread overview]
Message-ID: <1426957213-5508-1-git-send-email-sanidhya.gatech@gmail.com> (raw)

Checking for ENOMEM even for new_opts in reiserfs_remount function as
there is a possibility of nothing being allocated.

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:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21 17:00 Sanidhya Kashyap [this message]
2015-03-21 17:15 ` [PATCH] reiserfs: kstrdup() memory handling Josh Triplett
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=1426957213-5508-1-git-send-email-sanidhya.gatech@gmail.com \
    --to=sanidhya.gatech@gmail.com \
    --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=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rashika.kheria@gmail.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).