From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LYFJt-0001g0-7w for qemu-devel@nongnu.org; Sat, 14 Feb 2009 02:52:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LYFJp-0001ea-Sp for qemu-devel@nongnu.org; Sat, 14 Feb 2009 02:52:12 -0500 Received: from [199.232.76.173] (port=46726 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LYFJp-0001eU-Ok for qemu-devel@nongnu.org; Sat, 14 Feb 2009 02:52:09 -0500 Received: from vsmtp02.dti.ne.jp ([202.216.231.137]:58970) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LYFJo-0006WZ-Ii for qemu-devel@nongnu.org; Sat, 14 Feb 2009 02:52:09 -0500 Received: from [192.168.1.22] (PPPa840.e11.eacc.dti.ne.jp [124.255.89.82]) by vsmtp02.dti.ne.jp (3.11v) with ESMTP AUTH id n1E7q3lq022038 for ; Sat, 14 Feb 2009 16:52:03 +0900 (JST) Message-ID: <49967824.10807@juno.dti.ne.jp> Date: Sat, 14 Feb 2009 16:52:04 +0900 From: Shin-ichiro KAWASAKI MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] sh4: r2d fix no ide/net case References: <200902111545.n1BFjbSp027013@smtp09.dti.ne.jp> In-Reply-To: <200902111545.n1BFjbSp027013@smtp09.dti.ne.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 takasi-y@ops.dti.ne.jp wrote: > Fix invalid access/crash when there is no IDE device or NET device. I tested this patch and got sure about these two points. - Access to drives_table[-1] avoided. - SEGV on '-net none' avoided. It's worth to apply. Tested-by: Shin-ichiro KAWASAKI > Signed-off-by: Takashi YOSHII > --- > Current code doesn't check if IDE and NIC is present. > When no IDE is enabled, it accesses invalid adddress (drives_table[-1]). > When no NIC is enabled, it accesses NULL pointer and is killed by SEGV. > > SEGV case is easily be seen like below (by -net none) > $ sh4-softmmu/qemu-system-sh4 -M r2d -kernel kernel.kawa -net none > Segmentation fault > > This changes default model of 2nd NIC from ne2k-pci to rtl8139. > 2nd NIC on-board really was rtl8139. > > If you depends on old behavior use -net option, for example > -net nic -net nic,model=ne2k_pci > makes 2nd NIC to be ne2k_pci. > /yoshii > > --- > hw/r2d.c | 10 +++++----- > 1 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/hw/r2d.c b/hw/r2d.c > index 7dcb723..5360b4b 100644 > --- a/hw/r2d.c > +++ b/hw/r2d.c > @@ -224,13 +224,13 @@ static void r2d_init(ram_addr_t ram_size, int vga_ram_size, > serial_hds[2]); > (snip) Regards, Shin-ichiro KAWASAKI