From patchwork Thu Jan 20 10:31:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: pci: fix pcibus_get_dev_path() Date: Thu, 20 Jan 2011 00:31:59 -0000 From: TeLeMan X-Patchwork-Id: 79667 Message-Id: To: "Michael S. Tsirkin" , qemu-devel Cc: The commit 6a7005d14b3c32d4864a718fb1cb19c789f58a5 used snprintf() incorrectly. Signed-off-by: TeLeMan --- hw/pci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) return path; diff --git a/hw/pci.c b/hw/pci.c index 8d0e3df..9f8800d 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -2050,14 +2050,14 @@ static char *pcibus_get_dev_path(DeviceState *dev) path[path_len] = '\0'; /* First field is the domain. */ - snprintf(path, domain_len, "%04x:00", pci_find_domain(d->bus)); + snprintf(path, domain_len + 1, "%04x:00", pci_find_domain(d->bus)); /* Fill in slot numbers. We walk up from device to root, so need to print * them in the reverse order, last to first. */ p = path + path_len; for (t = d; t; t = t->bus->parent_dev) { p -= slot_len; - snprintf(p, slot_len, ":%02x.%x", PCI_SLOT(t->devfn), PCI_FUNC(d->devfn)); + snprintf(p, slot_len + 1, ":%02x.%x", PCI_SLOT(t->devfn), PCI_FUNC(d->devfn)); }