Re: [patch] kcore: fix test for end of list

From: AmÃrico Wang
Date: Tue Mar 23 2010 - 03:01:06 EST


On Tue, Mar 23, 2010 at 11:31 AM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 22 Mar 2010 15:05:09 +0300 Dan Carpenter <error27@xxxxxxxxx> wrote:
>
>> "m" is never NULL here. ÂWe need a different test for the end of list
>> condition.
>>
>> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
>> ---
>> Found with a static checker and compile tested only. ÂPlease review
>> carefully.
>>
>> diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
>> index a44a789..b442dac 100644
>> --- a/fs/proc/kcore.c
>> +++ b/fs/proc/kcore.c
>> @@ -490,7 +490,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
>> Â Â Â Â Â Â Â }
>> Â Â Â Â Â Â Â read_unlock(&kclist_lock);
>>
>> - Â Â Â Â Â Â if (m == NULL) {
>> + Â Â Â Â Â Â if (&m->list == &kclist_head) {
>> Â Â Â Â Â Â Â Â Â Â Â if (clear_user(buffer, tsz))
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return -EFAULT;
>> Â Â Â Â Â Â Â } else if (is_vmalloc_or_module_addr((void *)start)) {
>
> hm, that code's been there for five years. ÂI wonder if it's actually necessary.

Nope, not that long, please see commit 2ef43ec7. :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/