From ca14a28af36b00b50da70ce642eda6d8a1e82e3c Mon Sep 17 00:00:00 2001 From: Xue Liu Date: Wed, 15 Jan 2025 15:03:13 +0800 Subject: [PATCH] loongarch: bugfix 1. fix the introduced old code 2. clear buffer for screen information https://bugzilla.openanolis.cn/show_bug.cgi?id=9258 Project: TC2024110201 Signed-off-by: Xue Liu --- ...uffer-to-zero-for-screen-information.patch | 40 +++++++++++++++++++ grub.macros | 2 +- grub.patches | 1 + grub2.spec | 8 +++- 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 1010-Clear-buffer-to-zero-for-screen-information.patch diff --git a/1010-Clear-buffer-to-zero-for-screen-information.patch b/1010-Clear-buffer-to-zero-for-screen-information.patch new file mode 100644 index 0000000..b2604e8 --- /dev/null +++ b/1010-Clear-buffer-to-zero-for-screen-information.patch @@ -0,0 +1,40 @@ +From 50a6f8e80cec46932e53a73563d02e7739d69400 Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Wed, 23 Oct 2024 15:37:20 +0800 +Subject: [PATCH] Clear buffer to zero for screen information. Modify + introduced old code. + +--- + grub-core/kern/efi/mm.c | 2 +- + grub-core/loader/loongarch64/linux-elf.c | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c +index 6f8810e..4281feb 100644 +--- a/grub-core/kern/efi/mm.c ++++ b/grub-core/kern/efi/mm.c +@@ -469,7 +469,7 @@ filter_memory_map (grub_efi_memory_descriptor_t *memory_map, + #ifdef GRUB_CPU_LOONGARCH64 + && desc->physical_start <= grub_efi_max_usable_address() + #else +- && desc->physical_start <= GRUB_EFI_MAX_USABLE_ADDRESS ++ && desc->physical_start <= GRUB_EFI_MAX_ALLOCATION_ADDRESS + #endif + && desc->physical_start + PAGES_TO_BYTES (desc->num_pages) > 0x100000 + && desc->num_pages != 0) +diff --git a/grub-core/loader/loongarch64/linux-elf.c b/grub-core/loader/loongarch64/linux-elf.c +index bf3bfa4..34bfad7 100644 +--- a/grub-core/loader/loongarch64/linux-elf.c ++++ b/grub-core/loader/loongarch64/linux-elf.c +@@ -167,6 +167,8 @@ alloc_screen_info (void) + if (status != GRUB_EFI_SUCCESS) + return NULL; + ++ grub_memset((void *)si, 0, sizeof(struct screen_info)); ++ + status = b->install_configuration_table (&compat_screen_info_guid, si); + if (status != GRUB_EFI_SUCCESS) + goto free_mem; +-- +2.41.0 + diff --git a/grub.macros b/grub.macros index 40d7fd7..5ef8230 100644 --- a/grub.macros +++ b/grub.macros @@ -342,7 +342,7 @@ git add . \ git commit -a -q -m "%{tarversion} baseline." \ git am --whitespace=nowarn %%{patches} - 2.12-10_2 +- Fix the introduced old code +- Clear buffer for screen information + * Wed Jul 24 2024 Jun He - 2.12-9 - Updated cherry-picked NX patche series to fix setting memory attr failure -- Gitee