yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-s390-ipl-fix-off-by-one-in-update_machine_ipl_proper.patch

ddf19c
From 1769600e1e3bd5ca48450de8ce8a118bf0af96f3 Mon Sep 17 00:00:00 2001
ddf19c
From: Thomas Huth <thuth@redhat.com>
ddf19c
Date: Fri, 29 May 2020 05:54:00 -0400
ddf19c
Subject: [PATCH 18/42] s390/ipl: fix off-by-one in
ddf19c
 update_machine_ipl_properties()
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: Thomas Huth <thuth@redhat.com>
ddf19c
Message-id: <20200529055420.16855-19-thuth@redhat.com>
ddf19c
Patchwork-id: 97028
ddf19c
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 18/38] s390/ipl: fix off-by-one in update_machine_ipl_properties()
ddf19c
Bugzilla: 1828317
ddf19c
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
ddf19c
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
RH-Acked-by: David Hildenbrand <david@redhat.com>
ddf19c
ddf19c
From: Halil Pasic <pasic@linux.ibm.com>
ddf19c
ddf19c
In update_machine_ipl_properties() the array ascii_loadparm needs to
ddf19c
hold the 8 char loadparm and a string terminating zero char.
ddf19c
ddf19c
Let's increase the size of ascii_loadparm accordingly.
ddf19c
ddf19c
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
ddf19c
Fixes: 0a01e082a428 ("s390/ipl: sync back loadparm")
ddf19c
Fixes: Coverity CID 1421966
ddf19c
Reported-by: Peter Maydell <peter.maydell@linaro.org>
ddf19c
Message-Id: <20200320143101.41764-1-pasic@linux.ibm.com>
ddf19c
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ddf19c
(cherry picked from commit 7722837369eb1c7e808021d79da68afa0c01c26f)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 hw/s390x/ipl.c | 2 +-
ddf19c
 1 file changed, 1 insertion(+), 1 deletion(-)
ddf19c
ddf19c
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
ddf19c
index f25339c503..fa0409dc23 100644
ddf19c
--- a/hw/s390x/ipl.c
ddf19c
+++ b/hw/s390x/ipl.c
ddf19c
@@ -537,7 +537,7 @@ static void update_machine_ipl_properties(IplParameterBlock *iplb)
ddf19c
     /* Sync loadparm */
ddf19c
     if (iplb->flags & DIAG308_FLAGS_LP_VALID) {
ddf19c
         uint8_t *ebcdic_loadparm = iplb->loadparm;
ddf19c
-        char ascii_loadparm[8];
ddf19c
+        char ascii_loadparm[9];
ddf19c
         int i;
ddf19c
 
ddf19c
         for (i = 0; i < 8 && ebcdic_loadparm[i]; i++) {
ddf19c
-- 
ddf19c
2.27.0
ddf19c