summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorNeo Jia <cjia@nvidia.com>2016-03-10 09:39:09 -0700
committerAlex Williamson <alex.williamson@redhat.com>2016-03-10 20:50:43 -0700
commit062ed5d8d6edcba9cb8daecc764b7dcedf3e1009 (patch)
treeea6cd8fdaa81ad0cf6117c44e1616498713fb3c0 /hw
parente593c0211b8a9e47d3fd24d2be5900ecf5a03b03 (diff)
downloadqemu-062ed5d8d6edcba9cb8daecc764b7dcedf3e1009.tar.gz
qemu-062ed5d8d6edcba9cb8daecc764b7dcedf3e1009.tar.bz2
qemu-062ed5d8d6edcba9cb8daecc764b7dcedf3e1009.zip
vfio/pci: replace fixed string limit by g_strdup_printf
A trivial change to remove string limit by using g_strdup_printf Tested-by: Neo Jia <cjia@nvidia.com> Signed-off-by: Neo Jia <cjia@nvidia.com> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vfio/pci.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 30eb945a4f..d091d8cf0e 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -919,7 +919,7 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
uint32_t orig, size = cpu_to_le32((uint32_t)PCI_ROM_ADDRESS_MASK);
off_t offset = vdev->config_offset + PCI_ROM_ADDRESS;
DeviceState *dev = DEVICE(vdev);
- char name[32];
+ char *name;
int fd = vdev->vbasedev.fd;
if (vdev->pdev.romfile || !vdev->pdev.rom_bar) {
@@ -962,10 +962,11 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
trace_vfio_pci_size_rom(vdev->vbasedev.name, size);
- snprintf(name, sizeof(name), "vfio[%s].rom", vdev->vbasedev.name);
+ name = g_strdup_printf("vfio[%s].rom", vdev->vbasedev.name);
memory_region_init_io(&vdev->pdev.rom, OBJECT(vdev),
&vfio_rom_ops, vdev, name, size);
+ g_free(name);
pci_register_bar(&vdev->pdev, PCI_ROM_SLOT,
PCI_BASE_ADDRESS_SPACE_MEMORY, &vdev->pdev.rom);