lkml.org 
[lkml]   [2011]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86: Fix io_bitmap_ptr memory leak on copy_process()
>>> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
>>> index b3feabc..290e98b 100644
>>> --- a/arch/x86/kernel/process.c
>>> +++ b/arch/x86/kernel/process.c
>>> @@ -122,6 +122,12 @@ void flush_thread(void)
>>> clear_used_math();
>>> }
>>>
>>> +void free_thread_struct(struct task_struct *p)
>>> +{
>>> + if (p->thread.io_bitmap_ptr)
>>> + kfree(p->thread.io_bitmap_ptr);
>>
>> kfree(NULL) is perfectly legal, so the 'if' is not needed.

Thanks. agreed.

>> Why is this a new function? Why not simply call kfree() when needed.

io_bitmap_ptr is a x86 specific variable
so I didn't think it should be in generic kernel codes (kernel/fork.c).
I understand making a new function looks overkill though.
Even if you call kfree() directly in kernel/fork.c,
"#ifdef CONFIG_X86" is necessary anyway.

But I don't have any insistence on how to fix it and leave it to experts' choice.

Thanks
--
Tadashi


\
 
 \ /
  Last update: 2011-02-14 10:29    [W:0.035 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site