[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1291020917-8671-10-git-send-email-namhyung@gmail.com>
Date: Mon, 29 Nov 2010 17:55:11 +0900
From: Namhyung Kim <namhyung@...il.com>
To: Theodore Tso <tytso@....edu>
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 09/15] mke2fs: check return value of e2p_os2string()
e2p_os2string() calls malloc() so that it can return NULL.
Check it.
Signed-off-by: Namhyung Kim <namhyung@...il.com>
---
misc/mke2fs.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 9fb5d5f..90cc206 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -554,6 +554,10 @@ static void show_stats(ext2_filsys fs)
printf(_("Filesystem label=%s\n"), buf);
fputs(_("OS type: "), stdout);
os = e2p_os2string(fs->super->s_creator_os);
+ if (!os) {
+ fprintf(stderr, _("Couldn't allocate memory to show OS name!\n"));
+ exit(1);
+ }
fputs(os, stdout);
free(os);
printf("\n");
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists