VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Jesper Juhl <jesper.juhl@gmail.com> 2006-04-18 22:21:54 -0700 committer: Linus Torvalds <torvalds@g5.osdl.org> 2006-04-19 09:13:52 -0700 commit: aa1e816fc92215f94bdfd90107baae8fdc2440d1 parent: 9dfb563b07b1aafcd7d40528ebfa7f9ce28f0556
Commit Summary:
[PATCH] Fix potential NULL pointer deref in gen_init_cpio
Diffstat:
1 file changed, 3 insertions, 1 deletion
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[])
 				"ERROR: incorrect format, could not locate file type line %d: '%s'\n",
 				line_nr, line);
 			ec = -1;
+			break;
 		}
 
 		if ('\n' == *type) {
@@ -506,7 +507,8 @@ int main (int argc, char *argv[])
 				line_nr, line);
 		}
 	}
-	cpio_trailer();
+	if (ec == 0)
+		cpio_trailer();
 
 	exit(ec);
 }