yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
dc7afb
From 0e9bdb960045f98d70f765bbb585f1647e5fea08 Mon Sep 17 00:00:00 2001
dc7afb
From: Thomas Huth <thuth@redhat.com>
dc7afb
Date: Tue, 18 May 2021 13:51:23 -0400
dc7afb
Subject: [PATCH 3/5] pc-bios/s390-ccw: fix off-by-one error
dc7afb
MIME-Version: 1.0
dc7afb
Content-Type: text/plain; charset=UTF-8
dc7afb
Content-Transfer-Encoding: 8bit
dc7afb
dc7afb
RH-Author: Thomas Huth <thuth@redhat.com>
dc7afb
Message-id: <20210518135125.191329-2-thuth@redhat.com>
dc7afb
Patchwork-id: 101548
dc7afb
O-Subject: [RHEL-8.5.0 qemu-kvm PATCH 1/3] pc-bios/s390-ccw: fix off-by-one error
dc7afb
Bugzilla: 1942880
dc7afb
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
dc7afb
RH-Acked-by: David Hildenbrand <david@redhat.com>
dc7afb
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
dc7afb
dc7afb
This error takes effect when the magic value "zIPL" is located at the
dc7afb
end of a block. For example if s2_cur_blk = 0x7fe18000 and the magic
dc7afb
value "zIPL" is located at 0x7fe18ffc - 0x7fe18fff.
dc7afb
dc7afb
Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu")
dc7afb
Reviewed-by: Collin Walling <walling@linux.ibm.com>
dc7afb
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
dc7afb
Message-Id: <20200924085926.21709-2-mhartmay@linux.ibm.com>
dc7afb
Reviewed-by: Thomas Huth <thuth@redhat.com>
dc7afb
[thuth: Use "<= ... - 4" instead of "< ... - 3"]
dc7afb
Signed-off-by: Thomas Huth <thuth@redhat.com>
dc7afb
(cherry picked from commit 5f97ba0c74ccace0a4014460de9751ff3c6f454a)
dc7afb
Signed-off-by: Thomas Huth <thuth@redhat.com>
dc7afb
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
dc7afb
---
dc7afb
 pc-bios/s390-ccw/bootmap.c | 2 +-
dc7afb
 1 file changed, 1 insertion(+), 1 deletion(-)
dc7afb
dc7afb
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
dc7afb
index e91ea719ff..bb6e003270 100644
dc7afb
--- a/pc-bios/s390-ccw/bootmap.c
dc7afb
+++ b/pc-bios/s390-ccw/bootmap.c
dc7afb
@@ -163,7 +163,7 @@ static bool find_zipl_boot_menu_banner(int *offset)
dc7afb
     int i;
dc7afb
 
dc7afb
     /* Menu banner starts with "zIPL" */
dc7afb
-    for (i = 0; i < virtio_get_block_size() - 4; i++) {
dc7afb
+    for (i = 0; i <= virtio_get_block_size() - 4; i++) {
dc7afb
         if (magic_match(s2_cur_blk + i, ZIPL_MAGIC_EBCDIC)) {
dc7afb
             *offset = i;
dc7afb
             return true;
dc7afb
-- 
dc7afb
2.27.0
dc7afb