qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 04/14] Running with --enable-ubsan leads to a qtest failur


From: Akihiko Odaki
Subject: Re: [PATCH v2 04/14] Running with --enable-ubsan leads to a qtest failure
Date: Sat, 10 May 2025 13:27:18 +0900
User-agent: Mozilla Thunderbird

I think the subject should tell what this patch does and perhaps the underlying problem it solves instead of the symptom. It may be nice to have a prefix "tests/qtest/libqos/igb:" to comply the convention.

On 2025/05/06 21:57, Alex Bennée wrote:
From: Nabih Estefan <nabihestefan@google.com>

   ../tests/qtest/libqos/igb.c:106:5: runtime error: load of misaligned address 
0x562040be8e33 for type 'uint32_t', which requires 4 byte alignment

Instead of straight casting the uint8_t array, we use use ldl_le_p and
lduw_l_p to assure alignment is correct against uint32_t and uint16_t.

It does not assure an alignment is correct but instead performs an unaligned access.


Signed-off-by: Nabih Estefan <nabihestefan@google.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250429155621.2028198-1-nabihestefan@google.com>
[AJB: fix commit message, remove unneeded casts]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
  tests/qtest/libqos/igb.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/libqos/igb.c b/tests/qtest/libqos/igb.c
index f40c4ec4cd..7df9272069 100644
--- a/tests/qtest/libqos/igb.c
+++ b/tests/qtest/libqos/igb.c
@@ -104,10 +104,10 @@ static void igb_pci_start_hw(QOSGraphObject *obj)
      e1000e_macreg_write(&d->e1000e, E1000_RDT(0), 0);
      e1000e_macreg_write(&d->e1000e, E1000_RDH(0), 0);
      e1000e_macreg_write(&d->e1000e, E1000_RA,
-                        le32_to_cpu(*(uint32_t *)address));
+                        ldl_le_p(address));
      e1000e_macreg_write(&d->e1000e, E1000_RA + 4,
                          E1000_RAH_AV | E1000_RAH_POOL_1 |
-                        le16_to_cpu(*(uint16_t *)(address + 4)));
+                        lduw_le_p((address + 4)));

This line has are extra parentheses.

/* Set supported receive descriptor mode */
      e1000e_macreg_write(&d->e1000e,




reply via email to

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