From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSU6g-0003Ms-83 for qemu-devel@nongnu.org; Mon, 21 Nov 2011 08:40:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSU6T-0000kQ-Ve for qemu-devel@nongnu.org; Mon, 21 Nov 2011 08:40:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSU6T-0000jv-On for qemu-devel@nongnu.org; Mon, 21 Nov 2011 08:40:09 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pALDe91m006735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 21 Nov 2011 08:40:09 -0500 From: Gerd Hoffmann Date: Mon, 21 Nov 2011 14:40:02 +0100 Message-Id: <1321882802-3337-9-git-send-email-kraxel@redhat.com> In-Reply-To: <1321882802-3337-1-git-send-email-kraxel@redhat.com> References: <1321882802-3337-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 8/8] usb-linux: fix /proc/bus/usb/devices scan List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, Gerd Hoffmann , Markus Armbruster Commit 0c402e5abb8c2755390eee864b43a98280fc2453 is incomplete and misses one of the two function pointer calls in usb_host_scan_dev(). Add the additional port handling logic to the other call too. Spotted by Coverity. Cc: Markus Armbruster Signed-off-by: Gerd Hoffmann --- usb-linux.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index f086d57..d4426ea 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1568,7 +1568,12 @@ static int usb_host_scan_dev(void *opaque, USBScanFunc *func) if (line[0] == 'T' && line[1] == ':') { if (device_count && (vendor_id || product_id)) { /* New device. Add the previously discovered device. */ - ret = func(opaque, bus_num, addr, 0, class_id, vendor_id, + if (port > 0) { + snprintf(buf, sizeof(buf), "%d", port); + } else { + snprintf(buf, sizeof(buf), "?"); + } + ret = func(opaque, bus_num, addr, buf, class_id, vendor_id, product_id, product_name, speed); if (ret) { goto the_end; -- 1.7.1