提交 aa1e816f 编写于 作者: J Jesper Juhl 提交者: Linus Torvalds

[PATCH] Fix potential NULL pointer deref in gen_init_cpio

Fix potential NULL pointer deref in gen_init_cpio.c spotted by coverity
checker.  This fixes coverity bug #86

Without this patch we risk dereferencing a NULL `type' in the
"if ('\n' == *type) {" line.
Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 9dfb563b
...@@ -471,6 +471,7 @@ int main (int argc, char *argv[]) ...@@ -471,6 +471,7 @@ int main (int argc, char *argv[])
"ERROR: incorrect format, could not locate file type line %d: '%s'\n", "ERROR: incorrect format, could not locate file type line %d: '%s'\n",
line_nr, line); line_nr, line);
ec = -1; ec = -1;
break;
} }
if ('\n' == *type) { if ('\n' == *type) {
...@@ -506,7 +507,8 @@ int main (int argc, char *argv[]) ...@@ -506,7 +507,8 @@ int main (int argc, char *argv[])
line_nr, line); line_nr, line);
} }
} }
cpio_trailer(); if (ec == 0)
cpio_trailer();
exit(ec); exit(ec);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册