From patchwork Tue Aug 24 06:48:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken CC X-Patchwork-Id: 62555 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 5E9A3B70CC for ; Tue, 24 Aug 2010 16:54:28 +1000 (EST) Received: from localhost ([127.0.0.1]:47934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnnOo-0004FK-Pd for incoming@patchwork.ozlabs.org; Tue, 24 Aug 2010 02:54:22 -0400 Received: from [140.186.70.92] (port=45403 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnnJj-0002SC-IT for qemu-devel@nongnu.org; Tue, 24 Aug 2010 02:49:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnnJP-0004o9-UU for qemu-devel@nongnu.org; Tue, 24 Aug 2010 02:48:48 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:50697) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnnJP-0004nz-SK for qemu-devel@nongnu.org; Tue, 24 Aug 2010 02:48:47 -0400 Received: by qwh5 with SMTP id 5so5948225qwh.4 for ; Mon, 23 Aug 2010 23:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=5iKL8xhAFooN3PAOLCzz4f7ZQ3wuOTfRT8mjeXRKNnI=; b=GhtRUg5sj+YmXJtTBusZ5hydIpGvGhSgx6TVVtByzD6SJnj0ewQVucNRA2pldtiIiL 82dFPE1pMuHho4CLDh9USPIuiYjYHGkyXzhaczT5sfAeOm71aimmUZ/JtFxaToI/U+At EOtpOq+4zS7hmoXpXytAafIJE6Q4+w1fh4/eQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:in-reply-to:user-agent; b=PDoXPC2oBiRHPv1X2PQEz93dnh6n7cq6m8f2tr3UdzZBULKpGJcMpuCwuzoGgtXxKY 72a4VLYdtC+BXEHtSzOiaqdvx/yRH+BPgaku/gkisOn64CuB3ORo6AbViCMTnwAWx1jg ix9hyY9iCb+HKBhWi3vloOV7bzcCrutThgWvA= Received: by 10.229.175.167 with SMTP id ba39mr3917653qcb.181.1282632527219; Mon, 23 Aug 2010 23:48:47 -0700 (PDT) Received: from localhost ([60.247.97.98]) by mx.google.com with ESMTPS id r36sm8151832qcs.39.2010.08.23.23.48.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 23 Aug 2010 23:48:45 -0700 (PDT) Date: Tue, 24 Aug 2010 14:48:41 +0800 From: Ken CC To: kvm@vger.kernel.org Message-ID: <20100824064841.GA11495@kt> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100824063307.GA10815@kt> User-Agent: StGit/0.15-97-g9680 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: yamahata@valinux.co.jp, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus 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 assert(devfn < PCIBUS_MAX_DEVICES) Signed-off-by: Ken CC --- hw/pci.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 02019a1..1e804da 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, PCIConfigWriteFunc *config_write, bool is_bridge) { + assert(devfn < PCIBUS_MAX_DEVICES); if (devfn < 0) { for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); devfn += PCI_FUNC_MAX) {