From: Tadashi Abe <tabe@mvista.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: x86@kernel.org, tglx@linutronix.de, hpa@zytor.com,
mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Fix io_bitmap_ptr memory leak on copy_process()
Date: Mon, 14 Feb 2011 18:27:20 +0900 [thread overview]
Message-ID: <4D58F578.8090201@mvista.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1102101909520.26035@swampdragon.chaosbits.net>
>>> 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
prev parent reply other threads:[~2011-02-14 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-08 5:00 [PATCH] x86: Fix io_bitmap_ptr memory leak on copy_process() Tadashi Abe
2011-02-10 18:07 ` Jesper Juhl
2011-02-10 18:11 ` Jesper Juhl
2011-02-14 9:27 ` Tadashi Abe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D58F578.8090201@mvista.com \
--to=tabe@mvista.com \
--cc=hpa@zytor.com \
--cc=jj@chaosbits.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox