mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
To: mikulas@artax.karlin.mff.cuni.cz, 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] hpfs: kstrdup() memory handling
Date: Sat, 21 Mar 2015 12:57:50 -0400	[thread overview]
Message-ID: <1426957070-2914-1-git-send-email-sanidhya.gatech@gmail.com> (raw)

There is a possibility of nothing being allocated to the new_opts in
case of memory pressure, therefore return ENOMEM for such case.

Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
---
 fs/hpfs/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 7cd00d3..885eadb 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -424,6 +424,9 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
 	int o;
 	struct hpfs_sb_info *sbi = hpfs_sb(s);
 	char *new_opts = kstrdup(data, GFP_KERNEL);
+
+	if (!new_opts)
+		return -ENOMEM;
 	
 	sync_filesystem(s);
 
-- 
2.1.0


                 reply	other threads:[~2015-03-21 16:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1426957070-2914-1-git-send-email-sanidhya.gatech@gmail.com \
    --to=sanidhya.gatech@gmail.com \
    --cc=blee@gatech.edu \
    --cc=changwoo@gatech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikulas@artax.karlin.mff.cuni.cz \
    --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

Powered by JetHome