qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v4 04/13] hw/vfio/pci: introduce VFIODevice


From: Eric Auger
Subject: Re: [Qemu-devel] [RFC v4 04/13] hw/vfio/pci: introduce VFIODevice
Date: Wed, 23 Jul 2014 13:40:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 07/23/2014 12:24 PM, Peter Maydell wrote:
> On 23 July 2014 11:02, Eric Auger <address@hidden> wrote:
>> On 07/09/2014 12:41 AM, Alex Williamson wrote:
>>> On Mon, 2014-07-07 at 13:27 +0100, Eric Auger wrote:
>>>> +    vdev->vbasedev.ops = &vfio_pci_ops;
>>>> +
>>>> +    vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI;
>>>> +    vdev->vbasedev.name = g_malloc0(PATH_MAX);
>>>> +    snprintf(vdev->vbasedev.name, PATH_MAX, "%04x:%02x:%02x.%01x",
>>>> +            vdev->host.domain, vdev->host.bus, vdev->host.slot,
>>>> +            vdev->host.function);
>>>> +
>>>
>>> asprintf(3)?  This is a deterministic length, so PATH_MAX is especially
>>> ridiculous.
>> agreed, will use asprintf instead.
> 
> A minor nit given this is going to be in "only on Linux"
> code, but we generally prefer g_strdup_printf() over
> raw asprintf() (they do the same thing, but the glib
> function is guaranteed to be present everywhere,
> and the returned memory is freeable with g_free()
> like most of our strings, rather than needing to remember
> that it needs to be freed via free().)

Hi Peter,

thanks. this is noted.

BR

Eric
> 
> thanks
> -- PMM
> 




reply via email to

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