All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kexec/kexec.c: Add missing close() call
@ 2020-08-26  0:51 Youling Tang
  2020-08-26 15:53 ` Khalid Aziz
  0 siblings, 1 reply; 3+ messages in thread
From: Youling Tang @ 2020-08-26  0:51 UTC (permalink / raw)
  To: Simon Horman, Khalid Aziz and Shuah Khan, Eric W. Biederman; +Cc: kexec

Add missing close() call.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
 kexec/kexec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index a62b362..bb88caa 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -585,6 +585,7 @@ static char *slurp_file_generic(const char *filename, off_t *r_size,
 		die("Read on %s ended before stat said it should\n", filename);
 
 	*r_size = size;
+	close(fd);
 	return buf;
 }
 
@@ -1257,12 +1258,14 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
 	if (i == file_types) {
 		fprintf(stderr, "Cannot determine the file type " "of %s\n",
 				kernel);
+		close(kernel_fd);
 		return EFAILED;
 	}
 
 	ret = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info);
 	if (ret < 0) {
 		fprintf(stderr, "Cannot load %s\n", kernel);
+		close(kernel_fd);
 		return ret;
 	}
 
-- 
2.1.0


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kexec/kexec.c: Add missing close() call
  2020-08-26  0:51 [PATCH v2] kexec/kexec.c: Add missing close() call Youling Tang
@ 2020-08-26 15:53 ` Khalid Aziz
  2020-09-02 16:29   ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: Khalid Aziz @ 2020-08-26 15:53 UTC (permalink / raw)
  To: Youling Tang, Simon Horman, Eric W. Biederman; +Cc: kexec

On 8/25/20 6:51 PM, Youling Tang wrote:
> Add missing close() call.
> 
> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
> ---
>  kexec/kexec.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/kexec/kexec.c b/kexec/kexec.c
> index a62b362..bb88caa 100644
> --- a/kexec/kexec.c
> +++ b/kexec/kexec.c
> @@ -585,6 +585,7 @@ static char *slurp_file_generic(const char *filename, off_t *r_size,
>  		die("Read on %s ended before stat said it should\n", filename);
>  
>  	*r_size = size;
> +	close(fd);
>  	return buf;
>  }
>  
> @@ -1257,12 +1258,14 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
>  	if (i == file_types) {
>  		fprintf(stderr, "Cannot determine the file type " "of %s\n",
>  				kernel);
> +		close(kernel_fd);
>  		return EFAILED;
>  	}
>  
>  	ret = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info);
>  	if (ret < 0) {
>  		fprintf(stderr, "Cannot load %s\n", kernel);
> +		close(kernel_fd);
>  		return ret;
>  	}
>  
> 

This looks good to me.

Reviewed-by: Khalid Aziz <khalid@gonehiking.org>

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] kexec/kexec.c: Add missing close() call
  2020-08-26 15:53 ` Khalid Aziz
@ 2020-09-02 16:29   ` Simon Horman
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2020-09-02 16:29 UTC (permalink / raw)
  To: Khalid Aziz; +Cc: kexec, Youling Tang, Eric W. Biederman

On Wed, Aug 26, 2020 at 09:53:34AM -0600, Khalid Aziz wrote:
> On 8/25/20 6:51 PM, Youling Tang wrote:
> > Add missing close() call.
> > 
> > Signed-off-by: Youling Tang <tangyouling@loongson.cn>
> > ---
> >  kexec/kexec.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/kexec/kexec.c b/kexec/kexec.c
> > index a62b362..bb88caa 100644
> > --- a/kexec/kexec.c
> > +++ b/kexec/kexec.c
> > @@ -585,6 +585,7 @@ static char *slurp_file_generic(const char *filename, off_t *r_size,
> >  		die("Read on %s ended before stat said it should\n", filename);
> >  
> >  	*r_size = size;
> > +	close(fd);
> >  	return buf;
> >  }
> >  
> > @@ -1257,12 +1258,14 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
> >  	if (i == file_types) {
> >  		fprintf(stderr, "Cannot determine the file type " "of %s\n",
> >  				kernel);
> > +		close(kernel_fd);
> >  		return EFAILED;
> >  	}
> >  
> >  	ret = file_type[i].load(argc, argv, kernel_buf, kernel_size, &info);
> >  	if (ret < 0) {
> >  		fprintf(stderr, "Cannot load %s\n", kernel);
> > +		close(kernel_fd);
> >  		return ret;
> >  	}
> >  
> > 
> 
> This looks good to me.
> 
> Reviewed-by: Khalid Aziz <khalid@gonehiking.org>

Thanks, applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-02 16:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26  0:51 [PATCH v2] kexec/kexec.c: Add missing close() call Youling Tang
2020-08-26 15:53 ` Khalid Aziz
2020-09-02 16:29   ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.