From nobody Wed Oct 29 20:38:58 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525419023998456.3865388396483; Fri, 4 May 2018 00:30:23 -0700 (PDT) Received: from localhost ([::1]:60981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEVAd-0008Ij-8P for importer@patchew.org; Fri, 04 May 2018 03:30:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34137) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEV63-0004Pa-Ae for qemu-devel@nongnu.org; Fri, 04 May 2018 03:25:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEV62-0007JQ-3f for qemu-devel@nongnu.org; Fri, 04 May 2018 03:25:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48234 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fEV61-0007Ix-TX; Fri, 04 May 2018 03:25:38 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 778CE81A88AD; Fri, 4 May 2018 07:25:37 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31553215CDA7; Fri, 4 May 2018 07:25:37 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Fri, 4 May 2018 09:25:07 +0200 Message-Id: <20180504072514.8450-9-cohuck@redhat.com> In-Reply-To: <20180504072514.8450-1-cohuck@redhat.com> References: <20180504072514.8450-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 04 May 2018 07:25:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 04 May 2018 07:25:37 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 08/15] pc-bios/s390-ccw: fix loadparm initialization and int conversion X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Alexander Graf , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, Collin Walling , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Collin Walling Rename the loadparm char array in main.c to loadparm_str and increased the size by one byte to account for a null termination when converting the loadparm string to an int via atoui. We also allow the boot menu to be enabled when loadparm is set to an empty string or a series of spaces. Signed-off-by: Collin Walling Reported-by: Vasily Gorbik Reviewed-by: Thomas Huth Reviewed-by: Janosch Frank Signed-off-by: Thomas Huth --- hw/s390x/ipl.c | 4 ++++ pc-bios/s390-ccw/main.c | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index fb554ab156..150f6c0582 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -373,6 +373,10 @@ int s390_ipl_set_loadparm(uint8_t *loadparm) loadparm[i] =3D ascii2ebcdic[(uint8_t) lp[i]]; } =20 + if (i < 8) { + memset(loadparm + i, 0x40, 8 - i); /* fill with EBCDIC spaces = */ + } + g_free(lp); return 0; } diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 9d9f8cf4d3..26f9adf84a 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -15,11 +15,11 @@ char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); static SubChannelId blk_schid =3D { .one =3D 1 }; IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE))); -static char loadparm[8] =3D { 0, 0, 0, 0, 0, 0, 0, 0 }; +static char loadparm_str[9] =3D { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; QemuIplParameters qipl; =20 #define LOADPARM_PROMPT "PROMPT " -#define LOADPARM_EMPTY "........" +#define LOADPARM_EMPTY " " #define BOOT_MENU_FLAG_MASK (QIPL_FLAG_BM_OPTS_CMD | QIPL_FLAG_BM_OPTS_ZIP= L) =20 /* @@ -45,7 +45,7 @@ void panic(const char *string) =20 unsigned int get_loadparm_index(void) { - return atoui(loadparm); + return atoui(loadparm_str); } =20 static bool find_dev(Schib *schib, int dev_no) @@ -80,13 +80,13 @@ static bool find_dev(Schib *schib, int dev_no) =20 static void menu_setup(void) { - if (memcmp(loadparm, LOADPARM_PROMPT, 8) =3D=3D 0) { + if (memcmp(loadparm_str, LOADPARM_PROMPT, 8) =3D=3D 0) { menu_set_parms(QIPL_FLAG_BM_OPTS_CMD, 0); return; } =20 /* If loadparm was set to any other value, then do not enable menu */ - if (memcmp(loadparm, LOADPARM_EMPTY, 8) !=3D 0) { + if (memcmp(loadparm_str, LOADPARM_EMPTY, 8) !=3D 0) { return; } =20 @@ -116,8 +116,8 @@ static void virtio_setup(void) */ enable_mss_facility(); =20 - sclp_get_loadparm_ascii(loadparm); - memcpy(ldp + 10, loadparm, 8); + sclp_get_loadparm_ascii(loadparm_str); + memcpy(ldp + 10, loadparm_str, 8); sclp_print(ldp); =20 memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); --=20 2.14.3