[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v2 1/2] hw/arm: check fw_cfg return value before using
From: |
Hongbo Zhang |
Subject: |
[Qemu-arm] [PATCH v2 1/2] hw/arm: check fw_cfg return value before using it |
Date: |
Wed, 25 Jul 2018 13:30:51 +0800 |
The fw_cfg value returned from fw_cfg_find() may be NULL, so check it
before using.
Signed-off-by: Hongbo Zhang <address@hidden>
---
hw/arm/boot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index e09201c..43b217f 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -930,6 +930,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info
*info)
hwaddr entry;
static const ARMInsnFixup *primary_loader;
AddressSpace *as = arm_boot_address_space(cpu, info);
+ FWCfgState *fw_cfg;
/* CPU objects (unlike devices) are not automatically reset on system
* reset, so we must always register a handler to do so. If we're
@@ -960,11 +961,10 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info
*info)
info->dtb_start = info->loader_start;
}
- if (info->kernel_filename) {
- FWCfgState *fw_cfg;
+ fw_cfg = fw_cfg_find();
+ if (info->kernel_filename && fw_cfg) {
bool try_decompressing_kernel;
- fw_cfg = fw_cfg_find();
try_decompressing_kernel = arm_feature(&cpu->env,
ARM_FEATURE_AARCH64);
--
2.7.4
- [Qemu-arm] [PATCH v2 1/2] hw/arm: check fw_cfg return value before using it,
Hongbo Zhang <=
- [Qemu-arm] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Hongbo Zhang, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Shannon Zhao, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Daniel P . Berrangé, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Ard Biesheuvel, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Hongbo Zhang, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Ard Biesheuvel, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Hongbo Zhang, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Ard Biesheuvel, 2018/07/25
- Re: [Qemu-arm] [Qemu-devel] [PATCH v2 2/2] hw/arm: Add Arm Enterprise machine type, Andrew Jones, 2018/07/25