[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/12] qtest/fuzz: make range overlap check more readable
From: |
Thomas Huth |
Subject: |
[PULL 10/12] qtest/fuzz: make range overlap check more readable |
Date: |
Mon, 22 Jul 2024 14:00:24 +0200 |
From: Yao Xingtao <yaoxt.fnst@fujitsu.com>
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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Message-ID: <20240722040742.11513-8-yaoxt.fnst@fujitsu.com>
Signed-off-by: Thomas Huth <thuth@redhat.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 ec842e03c5..d107a496da 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.45.2
- [PULL 03/12] tests/avocado/boot_xen.py: use class attribute, (continued)
- [PULL 03/12] tests/avocado/boot_xen.py: use class attribute, Thomas Huth, 2024/07/22
- [PULL 02/12] tests/avocado/boot_xen.py: unify tags, Thomas Huth, 2024/07/22
- [PULL 08/12] tests/avocado/machine_aspeed.py: Increase timeout for TPM test, Thomas Huth, 2024/07/22
- [PULL 12/12] target/s390x: filter deprecated properties based on model expansion type, Thomas Huth, 2024/07/22
- [PULL 04/12] tests/avocado: Allow overwriting AVOCADO_SHOW env variable, Thomas Huth, 2024/07/22
- [PULL 07/12] tests/avocado: Remove the remainders of the virtiofs_submounts test, Thomas Huth, 2024/07/22
- [PULL 09/12] hw: Fix crash that happens when introspecting scsi-block on older machine types, Thomas Huth, 2024/07/22
- [PULL 11/12] tests: increase timeout per instance of bios-tables-test, Thomas Huth, 2024/07/22
- [PULL 06/12] tests/avocado/mem-addr-space-check: Remove unused "import signal", Thomas Huth, 2024/07/22
- [PULL 05/12] tests/avocado: Move LinuxTest related code into a separate file, Thomas Huth, 2024/07/22
- [PULL 10/12] qtest/fuzz: make range overlap check more readable,
Thomas Huth <=
- Re: [PULL 00/12] QTests, Avocado and s390x fixes for 9.1 softfreeze, Richard Henderson, 2024/07/22