1 Star 0 Fork 121

XuFei/src_openeuler_qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
seabios-add-check-to-avoid-dereference-NULL-pointer.patch 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
From e6b133311a7a5a618b48c6f38e3c3bb9e9a395c9 Mon Sep 17 00:00:00 2001
From: eillon <yezhenyu2@huawei.com>
Date: Mon, 14 Feb 2022 15:35:28 +0800
Subject: [PATCH] seabios: add check to avoid dereference NULL pointer
alloc_find_lowest() may return NULL, check it.
Signed-off-by: eillon <yezhenyu2@huawei.com>
---
roms/seabios/src/malloc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/roms/seabios/src/malloc.c b/roms/seabios/src/malloc.c
index 5827a6523..99fa3b7e0 100644
--- a/roms/seabios/src/malloc.c
+++ b/roms/seabios/src/malloc.c
@@ -544,10 +544,12 @@ malloc_prepboot(void)
// Clear unused f-seg ram.
struct allocinfo_s *info = alloc_find_lowest(&ZoneFSeg);
- u32 size = info->range_end - info->range_start;
- memset(memremap(info->range_start, size), 0, size);
- dprintf(1, "Space available for UMB: %x-%x, %x-%x\n"
- , RomEnd, base, info->range_start, info->range_end);
+ if (info) {
+ u32 size = info->range_end - info->range_start;
+ memset(memremap(info->range_start, size), 0, size);
+ dprintf(1, "Space available for UMB: %x-%x, %x-%x\n"
+ , RomEnd, base, info->range_start, info->range_end);
+ }
// We should not give back unused high ram, to support some special
// guest OS, like oracle linux series.
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/flyking001/src_openeuler_qemu.git
git@gitee.com:flyking001/src_openeuler_qemu.git
flyking001
src_openeuler_qemu
src_openeuler_qemu
master

搜索帮助