From mboxrd@z Thu Jan 1 00:00:00 1970 From: WANG Cong Subject: Re: [Patch] fs/binfmt_elf.c: fix a wrong free Date: Sun, 4 May 2008 22:30:11 +0800 Message-ID: <20080504143011.GB3720@hack> References: <20080503124610.GA3986@hack> <20080503143942.GE3986@hack> <481D9247.4010804@cs.helsinki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: WANG Cong , LKML , Eric Youngdale , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Andrew Morton To: Pekka Enberg Return-path: Received: from wf-out-1314.google.com ([209.85.200.173]:40235 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbYEDO0Q (ORCPT ); Sun, 4 May 2008 10:26:16 -0400 Received: by wf-out-1314.google.com with SMTP id 27so753069wfd.4 for ; Sun, 04 May 2008 07:26:16 -0700 (PDT) Content-Disposition: inline In-Reply-To: <481D9247.4010804@cs.helsinki.fi> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, May 04, 2008 at 01:39:03PM +0300, Pekka Enberg wrote: > Looks good although 'ret' is usually reserved for the variable that > contains the return value so you might want to consider using the more > idiomatic 'out' as the label name. > Thanks. Done. --- diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index f6d5a9d..357b503 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1900,7 +1900,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file, un /* alloc memory for large data structures: too large to be on stack */ elf = kmalloc(sizeof(*elf), GFP_KERNEL); if (!elf) - goto cleanup; + goto out; segs = current->mm->map_count; #ifdef ELF_CORE_EXTRA_PHDRS @@ -2034,8 +2034,9 @@ end_coredump: set_fs(fs); cleanup: - kfree(elf); free_note_info(&info); + kfree(elf); +out: return has_dumped; }