qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC][PATCH 11/14 v9] introduce a new monitor command '


From: Wen Congyang
Subject: Re: [Qemu-devel] [RFC][PATCH 11/14 v9] introduce a new monitor command 'dump' to dump guest's memory
Date: Fri, 16 Mar 2012 14:41:19 +0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4

At 03/16/2012 11:23 AM, HATAYAMA Daisuke Wrote:
> From: Wen Congyang <address@hidden>
> Subject: [RFC][PATCH 11/14 v9] introduce a new monitor command 'dump' to dump 
> guest's memory
> Date: Wed, 14 Mar 2012 10:11:35 +0800
> 
>> +/*
>> + * QEMU dump
>> + *
>> + * Copyright Fujitsu, Corp. 2011
>> + *
> 
> Now 2012.

On, I forgot to update it.

> 
>> +    /*
>> +     * calculate phdr_num
>> +     *
>> +     * the type of phdr->num is uint16_t, so we should avoid overflow
> 
> e_phnum is correct.

Yes
> 
>> +     */
>> +    s->phdr_num = 1; /* PT_NOTE */
>> +    if (s->list.num < (1 << 16) - 2) {
> 
> s->list.num < UINT16_MAX is better.
> 
>> +        s->phdr_num += s->list.num;
>> +        s->have_section = false;
>> +    } else {
>> +        s->have_section = true;
>> +        s->phdr_num = PN_XNUM;
>> +
>> +        /* the type of shdr->sh_info is uint32_t, so we should avoid 
>> overflow */
>> +        if (s->list.num > (1ULL << 32) - 2) {
> 
> s->list.num < UINT32_MAX is better.
> 
>> +            s->sh_info = 0xffffffff;
> 
> UINT32_MAX is better. Is it rough around here?
> 
>> +        } else {
>> +            s->sh_info += s->list.num;
>> +        }
>> +    }
> 
> Now orders of processings in positive and negative cases for e_phnum
> and sh_info are different. It's better to make them sorted in the same
> order.
> 
>   if (phdr_num not overflow?) {
>     not overflow case;
>   } else {
>     overflow case;
>     if (sh_info not overflow?) {
>       not overflow case;
>     } else {
>       overflow case;
>     }
>   }
> 
> is better.

OK

Thanks
Wen Congyang
> 
> Thanks.
> HATAYAMA, Daisuke
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]