[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/13] qtest/fuzz: make range overlap check more readable
From: |
Yao Xingtao |
Subject: |
[PATCH 07/13] qtest/fuzz: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 00:07:36 -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>
---
tests/qtest/fuzz/generic_fuzz.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
index ec842e03c5e6..d107a496da63 100644
--- a/tests/qtest/fuzz/generic_fuzz.c
+++ b/tests/qtest/fuzz/generic_fuzz.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/range.h"
#include <wordexp.h>
@@ -211,7 +212,7 @@ void fuzz_dma_read_cb(size_t addr, size_t len, MemoryRegion
*mr)
i < dma_regions->len && (avoid_double_fetches || qtest_log_enabled);
++i) {
region = g_array_index(dma_regions, address_range, i);
- if (addr < region.addr + region.size && addr + len > region.addr) {
+ if (ranges_overlap(addr, len, region.addr, region.size)) {
double_fetch = true;
if (addr < region.addr
&& avoid_double_fetches) {
--
2.41.0
- [PATCH 06/13] aspeed_smc: make range overlap check more readable, (continued)
- [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
- [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 <=
- [PATCH 03/13] core/loader: make range overlap check more readable, Yao Xingtao, 2024/07/22
- [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