[PATCH] makedumpfile: fix off-by-one bug in page_to_pfn()
Wen Congyang
wency at cn.fujitsu.com
Mon Dec 12 04:23:59 EST 2011
At 11/24/2011 01:20 PM, Atsushi Kumagai Write:
> Hi Wen,
>
> Thank you for the patch.
> I will check it.
Hi, kumagai
do you have any comment for this patch?
Thanks
Wen Congyang
>
> Thanks
> Kumagai
>
>
> On Wed, 23 Nov 2011 13:53:51 +0800
> Wen Congyang <wency at cn.fujitsu.com> wrote:
>
>> The pfn region in a mmd is [mmd->pfn_start, mmd->pfn_end).
>> So the max index should be mmd->pfn_end - mmd->pfn_start -1.
>> If index >=(not >) mmd->pfn_end - mmd->pfn_start, we should check
>> the next mmd.
>>
>> Signed-off-by: Wen Congyang <wency at cn.fujitsu.com>
>>
>> ---
>> makedumpfile.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/makedumpfile.c b/makedumpfile.c
>> index 7b7c266..db8e53f 100644
>> --- a/makedumpfile.c
>> +++ b/makedumpfile.c
>> @@ -2879,7 +2879,7 @@ page_to_pfn(unsigned long page)
>> if (page < mmd->mem_map)
>> continue;
>> index = (page - mmd->mem_map) / SIZE(page);
>> - if (index > mmd->pfn_end - mmd->pfn_start)
>> + if (index >= mmd->pfn_end - mmd->pfn_start)
>> continue;
>> pfn = mmd->pfn_start + index;
>> break;
>> --
>> 1.7.1
>
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>
More information about the kexec
mailing list