From patchwork Mon Apr 23 09:52:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Borntraeger X-Patchwork-Id: 154380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DD4FBB6EF1 for ; Mon, 23 Apr 2012 19:53:20 +1000 (EST) Received: from localhost ([::1]:50006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMFxO-0006SW-MD for incoming@patchwork.ozlabs.org; Mon, 23 Apr 2012 05:53:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMFwz-0006Jw-4I for qemu-devel@nongnu.org; Mon, 23 Apr 2012 05:53:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SMFwt-00025N-VB for qemu-devel@nongnu.org; Mon, 23 Apr 2012 05:52:52 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:43150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMFwt-00023u-Mb for qemu-devel@nongnu.org; Mon, 23 Apr 2012 05:52:47 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Apr 2012 10:52:44 +0100 Received: from d06nrmr1307.portsmouth.uk.ibm.com (9.149.38.129) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 23 Apr 2012 10:52:41 +0100 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q3N9qeQ92621640 for ; Mon, 23 Apr 2012 10:52:40 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q3N9qdR9008664 for ; Mon, 23 Apr 2012 03:52:40 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q3N9qdTd008645; Mon, 23 Apr 2012 03:52:39 -0600 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 984E41224104; Mon, 23 Apr 2012 11:52:39 +0200 (CEST) From: Christian Borntraeger To: Alexander Graf Date: Mon, 23 Apr 2012 11:52:19 +0200 Message-Id: <1335174745-45551-2-git-send-email-borntraeger@de.ibm.com> X-Mailer: git-send-email 1.7.9.6 In-Reply-To: <1335174745-45551-1-git-send-email-borntraeger@de.ibm.com> References: <1335174745-45551-1-git-send-email-borntraeger@de.ibm.com> x-cbid: 12042309-4966-0000-0000-0000021B969F X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.106 Cc: Cornelia Huck , Christian Borntraeger , Jens Freimann , qemu-devel Subject: [Qemu-devel] [PATCH 1/7] [s390] fix kernel_commandline handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Christian Borntraeger The current handling of kernel parameters is broken. The pointer is always valid, even if no -kernel or -append is specified. We must check if the kernel rom address is valid instead, otherwise qemu might segfault. Signed-off-by: Christian Borntraeger --- hw/s390-virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c index 1ebe70d..c79784c 100644 --- a/hw/s390-virtio.c +++ b/hw/s390-virtio.c @@ -274,7 +274,7 @@ static void s390_init(ram_addr_t my_ram_size, memcpy(rom_ptr(INITRD_PARM_SIZE), &initrd_size, 8); } - if (kernel_cmdline) { + if (rom_ptr(KERN_PARM_AREA)) { /* we have to overwrite values in the kernel image, which are "rom" */ memcpy(rom_ptr(KERN_PARM_AREA), kernel_cmdline, strlen(kernel_cmdline) + 1);