From: Alex Williamson <alex.williamson@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kirti Wankhede <kwankhede@nvidia.com>, Neo Jia <cjia@nvidia.com>
Subject: [Qemu-devel] [PULL 7/8] vfio/pci: replace fixed string limit by g_strdup_printf
Date: Wed, 09 Mar 2016 12:53:51 -0700 [thread overview]
Message-ID: <20160309195351.11580.44843.stgit@gimli.home> (raw)
In-Reply-To: <20160309195208.11580.57085.stgit@gimli.home>
From: Neo Jia <cjia@nvidia.com>
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>
---
hw/vfio/pci.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 30eb945..d091d8c 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);
next prev parent reply other threads:[~2016-03-09 19:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 19:53 [Qemu-devel] [PULL 0/8] VFIO updates 2016-03-09 Alex Williamson
2016-03-09 19:53 ` [Qemu-devel] [PULL 1/8] vfio: Add sysfsdev property for pci & platform Alex Williamson
2016-03-09 19:53 ` [Qemu-devel] [PULL 2/8] vfio: Wrap VFIO_DEVICE_GET_REGION_INFO Alex Williamson
2016-03-09 19:53 ` [Qemu-devel] [PULL 3/8] vfio: Generalize region support Alex Williamson
2016-03-10 0:54 ` Eric Auger
2016-03-10 16:34 ` Alex Williamson
2016-03-10 20:46 ` Eric Blake
2016-03-11 4:14 ` Alex Williamson
2016-03-09 19:53 ` [Qemu-devel] [PULL 4/8] vfio/pci: Convert all MemoryRegion to dynamic alloc and consistent functions Alex Williamson
2016-03-09 19:53 ` [Qemu-devel] [PULL 5/8] vfio/pci: Fixup PCI option ROMs Alex Williamson
2016-03-09 19:53 ` [Qemu-devel] [PULL 6/8] vfio/pci: Split out VGA setup Alex Williamson
2016-03-09 19:53 ` Alex Williamson [this message]
2016-03-09 19:53 ` [Qemu-devel] [PULL 8/8] MAINTAINERS: Add entry for the include/hw/vfio/ folder Alex Williamson
2016-03-10 5:03 ` [Qemu-devel] [PULL 0/8] VFIO updates 2016-03-09 Peter Maydell
2016-03-10 5:04 ` Peter Maydell
2016-03-10 15:00 ` Alex Williamson
-- strict thread matches above, loose matches on Subject: below --
2016-03-10 16:55 [Qemu-devel] [PULL 0/8] VFIO updates 2016-03-10 Alex Williamson
2016-03-10 16:56 ` [Qemu-devel] [PULL 7/8] vfio/pci: replace fixed string limit by g_strdup_printf Alex Williamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160309195351.11580.44843.stgit@gimli.home \
--to=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=kwankhede@nvidia.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).