[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/13] core/loader: make range overlap check more readable
From: |
Yao Xingtao |
Subject: |
[PATCH 03/13] core/loader: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 00:07:32 -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/core/loader.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 31593a117171..dac0df561b16 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -63,6 +63,7 @@
#include "qemu/cutils.h"
#include "sysemu/runstate.h"
#include "tcg/debuginfo.h"
+#include "qemu/range.h"
#include <zlib.h>
@@ -1278,7 +1279,8 @@ static bool roms_overlap(Rom *last_rom, Rom *this_rom)
return false;
}
return last_rom->as == this_rom->as &&
- last_rom->addr + last_rom->romsize > this_rom->addr;
+ ranges_overlap(last_rom->addr, last_rom->romsize,
+ this_rom->addr, this_rom->romsize);
}
static const char *rom_as_name(Rom *rom)
--
2.41.0
- Re: [PATCH 08/13] sparc/ldst_helper: make range overlap check more readable, (continued)
- [PATCH 11/13] crypto/block-luks: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 09/13] system/memory_mapping: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 07/13] qtest/fuzz: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [PATCH 03/13] core/loader: make range overlap check more readable,
Yao Xingtao <=
- [PATCH 12/13] dump: make range overlap check more readable, Yao Xingtao, 2024/07/22
- Re: [PATCH 00/13] make range overlap check more readable, Philippe Mathieu-Daudé, 2024/07/22