From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [Patch 2/3] elf: clean up fill_note_info() Date: Wed, 1 Jul 2009 12:29:55 -0700 Message-ID: <20090701122955.da45e073.akpm@linux-foundation.org> References: <20090701050840.6188.84560.sendpatchset@localhost.localdomain> <20090701050850.6188.59496.sendpatchset@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, roland@redhat.com, serue@us.ibm.com, dhowells@redhat.com, amwang@redhat.com, jmorris@namei.org, linux-fsdevel@vger.kernel.org To: Amerigo Wang Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:49886 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753704AbZGATaL (ORCPT ); Wed, 1 Jul 2009 15:30:11 -0400 In-Reply-To: <20090701050850.6188.59496.sendpatchset@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 1 Jul 2009 01:06:36 -0400 Amerigo Wang wrote: > +#define NUM_NOTES 6 > info->notes = kmalloc(NUM_NOTES * sizeof(struct memelfnote), > GFP_KERNEL); > +#undef NUM_NOTES That #define amounts to a really perverse code comment. How about we do this? --- a/fs/binfmt_elf.c~elf-clean-up-fill_note_info-fix +++ a/fs/binfmt_elf.c @@ -1719,10 +1719,8 @@ static int elf_note_info_init(struct elf memset(info, 0, sizeof(*info)); INIT_LIST_HEAD(&info->thread_list); -#define NUM_NOTES 6 - info->notes = kmalloc(NUM_NOTES * sizeof(struct memelfnote), - GFP_KERNEL); -#undef NUM_NOTES + /* Allocate space for six ELF notes */ + info->notes = kmalloc(6 * sizeof(struct memelfnote), GFP_KERNEL); if (!info->notes) return 0; info->psinfo = kmalloc(sizeof(*info->psinfo), GFP_KERNEL); _