qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 02/13] arm/boot: make range overlap check more readable


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 02/13] arm/boot: make range overlap check more readable
Date: Mon, 22 Jul 2024 08:54:54 +0200
User-agent: Mozilla Thunderbird

On 22/7/24 06:07, Yao Xingtao via wrote:
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)));

Indentation is of, otherwise:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]