qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] net: roll back qdev_prop_vlan


From: Zhi Yong Wu
Subject: Re: [Qemu-devel] [PATCH] net: roll back qdev_prop_vlan
Date: Mon, 18 Jun 2012 20:48:06 +0800

Good catch, thanks, please next version.

On Mon, Jun 18, 2012 at 6:22 PM, Stefan Hajnoczi
<address@hidden> wrote:
> On Sun, Jun 17, 2012 at 12:30:32AM +0800, address@hidden wrote:
>> +static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t 
>> len)
>> +{
>> +    NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
>> +
>> +    if (*ptr) {
>> +        unsigned int id;
>> +        if (!net_hub_id_for_client(*ptr, &id)) {
>> +            return snprintf(dest, len, "%d", id);
>
> Unsigned int should be %u.  Source code scanners or the compiler could
> warn about this so it's worth changing.
>
>> +        }
>> +    }
>> +
>> +    return snprintf(dest, len, "<null>");
>> +}
>> +
>> +static void get_vlan(Object *obj, Visitor *v, void *opaque,
>> +                     const char *name, Error **errp)
>> +{
>> +    DeviceState *dev = DEVICE(obj);
>> +    Property *prop = opaque;
>> +    NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
>> +    int64_t id = -1;
>> +
>> +    if (*ptr) {
>> +        unsigned int hub_id;
>> +        net_hub_id_for_client(*ptr, &hub_id);
>
> It's unclear what happens if net_hub_id_for_client() fails but it looks
> like hub_id may be uninitialized.
>
> Stefan
>



-- 
Regards,

Zhi Yong Wu



reply via email to

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