qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1 2/2] generic-loader: Add a generic loader


From: Alistair Francis
Subject: Re: [Qemu-devel] [PATCH v1 2/2] generic-loader: Add a generic loader
Date: Thu, 18 Feb 2016 11:34:49 -0800

On Thu, Feb 18, 2016 at 10:58 AM, Hollis Blanchard
<address@hidden> wrote:
> On 02/18/2016 10:49 AM, Alistair Francis wrote:
>>
>> On Thu, Feb 18, 2016 at 10:23 AM, Hollis Blanchard
>> <address@hidden> wrote:
>>>
>>> On 02/17/2016 01:04 PM, Alistair Francis wrote:
>>>>
>>>> +static void generic_loader_reset(DeviceState *dev)
>>>> +{
>>>> +    GenericLoaderState *s = GENERIC_LOADER(dev);
>>>> +
>>>> +    if (s->cpu) {
>>>> +        CPUClass *cc = CPU_GET_CLASS(s->cpu);
>>>> +        cpu_reset(s->cpu);
>>>> +        cc->set_pc(s->cpu, s->addr);
>>>> +    }
>>>> +
>>>> +    if (s->data_len) {
>>>> +        dma_memory_write((s->cpu ? s->cpu : first_cpu)->as, s->addr,
>>>> &s->data,
>>>> +                         s->data_len);
>>>> +    }
>>>> +}
>>>
>>>
>>> What happens if I accidentally make "data-len" bigger than
>>> sizeof(s->data)?
>>> I think some bounds checking is needed?
>>
>> Good point! I'll add an assert as it isn't a recoverable error.
>
>
> Perhaps a more user-friendly error message would be, well, more
> user-friendly. :-) That could be done when reading the "data-len" property,
> in addition to an assert when using s->data_len.

Fair enough, there is now a more appropriate check in the realise function.

Thanks,

Alistair

>
>
> Hollis Blanchard
> Mentor Graphics Emulation Division
>



reply via email to

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