Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Khalid Aziz <khalid@gonehiking.org>
To: Youling Tang <tangyouling@loongson.cn>,
	Simon Horman <horms@verge.net.au>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Cc: kexec@lists.infradead.org
Subject: Re: [PATCH v2] kexec/kexec.c: Add missing close() call
Date: Wed, 26 Aug 2020 09:53:34 -0600	[thread overview]
Message-ID: <faeb80e8-8d44-a0fb-bf7c-046df8b9433a@gonehiking.org> (raw)
In-Reply-To: <1598403114-19103-1-git-send-email-tangyouling@loongson.cn>

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

  reply	other threads:[~2020-08-26 15:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26  0:51 [PATCH v2] kexec/kexec.c: Add missing close() call Youling Tang
2020-08-26 15:53 ` Khalid Aziz [this message]
2020-09-02 16:29   ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=faeb80e8-8d44-a0fb-bf7c-046df8b9433a@gonehiking.org \
    --to=khalid@gonehiking.org \
    --cc=ebiederm@xmission.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=tangyouling@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox