aboutsummaryrefslogtreecommitdiffstats
path: root/usr/gen_init_cpio.c
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2006-04-19 01:21:54 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-19 12:13:52 -0400
commitaa1e816fc92215f94bdfd90107baae8fdc2440d1 (patch)
tree1d520ff39b65a7d3a5f68008eb44ea15c63e0d96 /usr/gen_init_cpio.c
parent9dfb563b07b1aafcd7d40528ebfa7f9ce28f0556 (diff)
[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: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'usr/gen_init_cpio.c')
-rw-r--r--usr/gen_init_cpio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 33dbcbf77c5b..83acd6cc0b3c 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -471,6 +471,7 @@ int main (int argc, char *argv[])
471 "ERROR: incorrect format, could not locate file type line %d: '%s'\n", 471 "ERROR: incorrect format, could not locate file type line %d: '%s'\n",
472 line_nr, line); 472 line_nr, line);
473 ec = -1; 473 ec = -1;
474 break;
474 } 475 }
475 476
476 if ('\n' == *type) { 477 if ('\n' == *type) {
@@ -506,7 +507,8 @@ int main (int argc, char *argv[])
506 line_nr, line); 507 line_nr, line);
507 } 508 }
508 } 509 }
509 cpio_trailer(); 510 if (ec == 0)
511 cpio_trailer();
510 512
511 exit(ec); 513 exit(ec);
512} 514}