From patchwork Thu Jan 20 10:31:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TeLeMan X-Patchwork-Id: 79667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 89F66B70CC for ; Thu, 20 Jan 2011 21:33:54 +1100 (EST) Received: from localhost ([127.0.0.1]:58738 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfrpu-00009f-OD for incoming@patchwork.ozlabs.org; Thu, 20 Jan 2011 05:33:50 -0500 Received: from [140.186.70.92] (port=37183 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pfro9-0007vn-F2 for qemu-devel@nongnu.org; Thu, 20 Jan 2011 05:32:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pfro8-0003YR-Bg for qemu-devel@nongnu.org; Thu, 20 Jan 2011 05:32:01 -0500 Received: from mail-qw0-f45.google.com ([209.85.216.45]:51020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pfro8-0003YM-9I for qemu-devel@nongnu.org; Thu, 20 Jan 2011 05:32:00 -0500 Received: by qwk4 with SMTP id 4so421037qwk.4 for ; Thu, 20 Jan 2011 02:31:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=byYm/L2EroiEQQD+Hv+6QQL9L5HC8X3XfCL/cGWeWOc=; b=wjvjhERkinGfpHZZbJitJ9S57RMfJEF/ETYGM5gQH2GmDUiQa8SFdjpN50nOBuCWO7 yyrdBW2LfcJJRXJ6PScZtfkkm1t8DEEWAL4GY0L+07oCDI+cbAjgFLQWAFQKJxY7Fli5 kcaxP0jievCa6w4Nm7ewLhcwZDg8E3rV4+Bf8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ZwRh7f5wQjIxQ5zuhWcWRAYkaz+c1kfoneIkOjARxob4dNcrOr5QS6Q+i4kArf/lZu KwpcIssjZ7XOWr4Z51yRwDcoYB7yaHbH1Jo0SpI2Lg56PeXBzhNZbJNCvifK0pp+IkK1 xXRnIrddTVQTxhFPK153ClXt/UXdz6TFQ7nvE= MIME-Version: 1.0 Received: by 10.224.191.196 with SMTP id dn4mr1739373qab.225.1295519519517; Thu, 20 Jan 2011 02:31:59 -0800 (PST) Received: by 10.220.202.137 with HTTP; Thu, 20 Jan 2011 02:31:59 -0800 (PST) Date: Thu, 20 Jan 2011 18:31:59 +0800 Message-ID: From: TeLeMan To: "Michael S. Tsirkin" , qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [Qemu-devel] [PATCH] pci: fix pcibus_get_dev_path() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)); }