public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: linux-ext4@vger.kernel.org
Cc: Ted Ts'o <tytso@mit.edu>
Subject: [patch]check NULL pointer
Date: Thu, 09 Jun 2011 11:31:32 +0800	[thread overview]
Message-ID: <1307590292.15392.71.camel@sli10-conroe> (raw)

orig_data could be NULL.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index cc5c157..45fc255 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3057,6 +3057,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
 	ext4_group_t first_not_zeroed;
 
+	if (!orig_data)
+		return ret;
 	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
 	if (!sbi)
 		goto out_free_orig;
@@ -4285,6 +4287,8 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
 #endif
 	char *orig_data = kstrdup(data, GFP_KERNEL);
 
+	if (!orig_data)
+		return -ENOMEM;
 	/* Store the original options */
 	lock_super(sb);
 	old_sb_flags = sb->s_flags;



             reply	other threads:[~2011-06-09  3:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  3:31 Shaohua Li [this message]
2011-06-09  9:24 ` [patch]check NULL pointer Lukas Czerner
2011-06-09 14:51   ` Eric Sandeen
2011-06-10  6:34     ` Shaohua Li
2011-06-10  8:32       ` Lukas Czerner
2011-06-13  7:30         ` Shaohua Li
2011-06-13  9:20           ` Lukas Czerner
2011-06-13 21:02             ` Ted Ts'o
2011-06-14  0:31             ` Shaohua Li
2011-06-14 10:07               ` Lukas Czerner

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=1307590292.15392.71.camel@sli10-conroe \
    --to=shaohua.li@intel.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.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