From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LeO2C-0004wX-Kp for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:23:20 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LeO2B-0004w7-Vn for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:23:20 -0500 Received: from [199.232.76.173] (port=33434 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LeO2B-0004w1-Kc for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:23:19 -0500 Received: from savannah.gnu.org ([199.232.41.3]:40677 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LeO2B-0006Ge-Dl for qemu-devel@nongnu.org; Tue, 03 Mar 2009 01:23:19 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LeO2A-0005fj-FR for qemu-devel@nongnu.org; Tue, 03 Mar 2009 06:23:18 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LeO2A-0005ff-4h for qemu-devel@nongnu.org; Tue, 03 Mar 2009 06:23:18 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Tue, 03 Mar 2009 06:23:18 +0000 Subject: [Qemu-devel] [6673] sh4: r2d fix no ide/net case Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6673 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6673 Author: aurel32 Date: 2009-03-03 06:23:17 +0000 (Tue, 03 Mar 2009) Log Message: ----------- sh4: r2d fix no ide/net case Fix invalid access/crash when there is no IDE device or NET device. Signed-off-by: Takashi YOSHII Tested-by: Shin-ichiro KAWASAKI Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/hw/r2d.c Modified: trunk/hw/r2d.c =================================================================== --- trunk/hw/r2d.c 2009-03-03 06:14:43 UTC (rev 6672) +++ trunk/hw/r2d.c 2009-03-03 06:23:17 UTC (rev 6673) @@ -224,13 +224,13 @@ serial_hds[2]); /* onboard CF (True IDE mode, Master only). */ - mmio_ide_init(0x14001000, 0x1400080c, irq[CF_IDE], 1, - drives_table[drive_get_index(IF_IDE, 0, 0)].bdrv, NULL); + if ((i = drive_get_index(IF_IDE, 0, 0)) != -1) + mmio_ide_init(0x14001000, 0x1400080c, irq[CF_IDE], 1, + drives_table[i].bdrv, NULL); /* NIC: rtl8139 on-board, and 2 slots. */ - pci_nic_init(pci, &nd_table[0], 2 << 3, "rtl8139"); - for (i = 1; i < nb_nics; i++) - pci_nic_init(pci, &nd_table[i], -1, "ne2k_pci"); + for (i = 0; i < nb_nics; i++) + pci_nic_init(pci, &nd_table[i], (i==0)? 2<<3: -1, "rtl8139"); /* Todo: register on board registers */ {