From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amerigo Wang Subject: Re: [Patch 2/3] elf: clean up fill_note_info() Date: Thu, 02 Jul 2009 17:40:26 +0800 Message-ID: <4A4C808A.9010302@redhat.com> References: <20090701050840.6188.84560.sendpatchset@localhost.localdomain> <20090701050850.6188.59496.sendpatchset@localhost.localdomain> <20090701122955.da45e073.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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, jmorris@namei.org, linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from mx2.redhat.com ([66.187.237.31]:60923 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851AbZGBJiQ (ORCPT ); Thu, 2 Jul 2009 05:38:16 -0400 In-Reply-To: <20090701122955.da45e073.akpm@linux-foundation.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Andrew Morton wrote: > 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? > Ah, better! No problem for me. Thank you! > --- 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); > _ > >