lkml.org 
[lkml]   [2009]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch 2/3] elf: clean up fill_note_info()
Andrew Morton wrote:
> On Wed, 1 Jul 2009 01:06:36 -0400
> Amerigo Wang <amwang@redhat.com> 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);
> _
>
>



\
 
 \ /
  Last update: 2009-07-02 11:41    [W:0.078 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site