public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney.cavm@gmail.com>
To: Cong Ding <dinggnu@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, Matt Fleming <matt.fleming@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: boot/compressed/mkpiggy.c: fix resource leakage
Date: Mon, 14 Jan 2013 17:18:38 -0800	[thread overview]
Message-ID: <50F4AE6E.6080103@gmail.com> (raw)
In-Reply-To: <1358187343-15752-1-git-send-email-dinggnu@gmail.com>

On 01/14/2013 10:14 AM, Cong Ding wrote:
> the file should be closed if it goes to error.
>

What tool are you using to generate all these patches?


> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
>   arch/x86/boot/compressed/mkpiggy.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
> index 958a641..e29154f 100644
> --- a/arch/x86/boot/compressed/mkpiggy.c
> +++ b/arch/x86/boot/compressed/mkpiggy.c
> @@ -58,6 +58,7 @@ int main(int argc, char *argv[])
>
>   	if (fread(&olen, sizeof(olen), 1, f) != 1) {
>   		perror(argv[1]);
> +		fclose(f);

The next line is a return from main().  All FILEs will be automatically 
closed by the C library, so your change is redundant.

The x86 maintainers can do what ever they want with it.  But to me, it 
seems like unnecessary code churn.

David Daney

>   		return 1;
>   	}
>
>


      reply	other threads:[~2013-01-15  1:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 18:14 [PATCH] x86: boot/compressed/mkpiggy.c: fix resource leakage Cong Ding
2013-01-15  1:18 ` David Daney [this message]

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=50F4AE6E.6080103@gmail.com \
    --to=ddaney.cavm@gmail.com \
    --cc=dinggnu@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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