[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/13] arm/boot: make range overlap check more readable
From: |
Yao Xingtao |
Subject: |
[PATCH 02/13] arm/boot: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 00:07:31 -0400 |
use ranges_overlap() instead of open-coding the overlap check to improve
the readability of the code.
Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com>
---
hw/arm/boot.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index d480a7da02cf..a004a90e87be 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -26,6 +26,7 @@
#include "qemu/config-file.h"
#include "qemu/option.h"
#include "qemu/units.h"
+#include "qemu/range.h"
/* Kernel boot protocol is specified in the kernel docs
* Documentation/arm/Booting and Documentation/arm64/booting.txt
@@ -238,8 +239,8 @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
assert((mvbar_addr & 0x1f) == 0 && (mvbar_addr >> 4) < 0x100);
/* check that these blobs don't overlap */
- assert((mvbar_addr + sizeof(mvbar_blob) <= info->board_setup_addr)
- || (info->board_setup_addr + sizeof(board_setup_blob) <=
mvbar_addr));
+ assert(!ranges_overlap(mvbar_addr, sizeof(mvbar_blob),
+ info->board_setup_addr, sizeof(board_setup_blob)));
for (n = 0; n < ARRAY_SIZE(mvbar_blob); n++) {
mvbar_blob[n] = tswap32(mvbar_blob[n]);
--
2.41.0
- [PATCH 00/13] make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 01/13] range: Make ranges_overlap() return bool, Yao Xingtao, 2024/07/22
- [PATCH 02/13] arm/boot: make range overlap check more readable,
Yao Xingtao <=
- [PATCH 04/13] cxl/mailbox: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 13/13] block/qcow2-cluster: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 05/13] display/sm501: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 10/13] block/vhdx: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 06/13] aspeed_smc: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 08/13] sparc/ldst_helper: make range overlap check more readable, Yao Xingtao, 2024/07/22