kexec/fs2dt: Check for NULL pointer in dt_copy_old_root_param()
Subsystems (2)
PATCH 1/1 kexec/fs2dt: Check for NULL pointer in dt_copy_old_root_param()
In dt_copy_old_root_param(), FILE * returned from fopen is not checked for NULL pointer before passinig to fclose(). This could trigger a segfault. Patch adds a check.
--- kexec/fs2dt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kexec/fs2dt.c +2 -1
@@ -540,7 +540,8 @@ static void dt_copy_old_root_param(void)if (last_cmdline)free (last_cmdline); -fclose (fp); +if (fp) +fclose (fp); }/*
Signature · 7 lines
2.7.4 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 32 lines · Madhavan Srinivasan
In
dt_copy_old_root_param(), FILE * returned from fopen is not checked for NULL pointer before passinig tofclose(). This could trigger a segfault. Patch adds a check.Signed-off-by Madhavan Srinivasan <[email protected]>--- kexec/fs2dt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kexec/fs2dt.c +2
-1@@ -540,7 +540,8 @@ static void dt_copy_old_root_param(void)if (last_cmdline)free (last_cmdline); -fclose (fp); +if (fp) +fclose (fp); }/* Signature · 7 lines
2.7.4 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Thanks
Dave
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 15 lines · Madhavan Srinivasan
In
dt_copy_old_root_param(), FILE * returned from fopen is not checked for NULL pointer before passinig tofclose(). This could trigger a segfault. Patch adds a check.Signed-off-by Madhavan Srinivasan <[email protected]>--- kexec/fs2dt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kexec/fs2dt.c +0
-0
kexec/fs2dt.c static void dt_copy_old_root_param(void) · line 544
Quoted 6 lines
kexec/fs2dt.c +2
-1@@ -540,7 +540,8 @@ static void dt_copy_old_root_param(void)if (last_cmdline)free (last_cmdline); -fclose (fp); +if (fp) +fclose (fp);
Looks fine, however a better practise could be to return just after fopen() if fp was null.
~Pratyush
Quoted 11 lines
kexec/fs2dt.c +0
-0}/* Signature · 7 lines
2.7.4 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 19 lines · Pratyush Anand
Quoted 18 lines · Madhavan Srinivasan
In
dt_copy_old_root_param(), FILE * returned from fopen is not checked for NULL pointer before passinig tofclose(). This could trigger a segfault. Patch adds a check.Signed-off-by Madhavan Srinivasan <[email protected]>--- kexec/fs2dt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kexec/fs2dt.c +0
-0@@ -540,7 +540,8 @@ static void dt_copy_old_root_param(void)if (last_cmdline)free (last_cmdline);
Quoted 6 lines
kexec/fs2dt.c static void dt_copy_old_root_param(void) · line 544
Quoted 3 lines
kexec/fs2dt.c +2
-1-fclose (fp); +if (fp) +fclose (fp);Looks fine, however a better practise could be to return just after
fopen()if fp was null.
That sounds like it would be somewhat cleaner.
Madhavan, could you see about making it so?
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 20 lines · Simon Horman
Quoted 19 lines · Pratyush Anand
Quoted 18 lines · Madhavan Srinivasan
In
dt_copy_old_root_param(), FILE * returned from fopen is not checked for NULL pointer before passinig tofclose(). This could trigger a segfault. Patch adds a check.Signed-off-by Madhavan Srinivasan <[email protected]>--- kexec/fs2dt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kexec/fs2dt.c +0
-0@@ -540,7 +540,8 @@ static void dt_copy_old_root_param(void)if (last_cmdline)free (last_cmdline);
Quoted 7 lines
Quoted 5 lines
kexec/fs2dt.c static void dt_copy_old_root_param(void) · line 544
Quoted 3 lines
kexec/fs2dt.c +2
-1-fclose (fp); +if (fp) +fclose (fp);Looks fine, however a better practise could be to return just after
fopen()if fp was null.That sounds like it would be somewhat cleaner.
Madhavan, could you see about making it so?
Yep. re-spinning now.
Maddy
Quoted 1 line
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec