On 07/23/2014 12:24 PM, Peter Maydell wrote: > On 23 July 2014 11:02, Eric Auger <eric.au...@linaro.org> 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 >