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

[Xen-devel] [PATCH] rombios: work around clang's -Waddress-of-packed-member



Building rombios with clang XXX fails with:

tcgbios.c:1519:34: error: taking address of packed member 'u' of class or 
structure 'pushad_regs_t' may result in an unaligned pointer value 
[-Werror,-Waddress-of-packed-member]
                                              ®s->u.r32.edx);
                                               ^~~~~~~~~~~~~~~

Work around that by using an intermediate variable.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/firmware/rombios/32bit/tcgbios/tcgbios.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c 
b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
index fa22c4460a..581340da8e 100644
--- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
+++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c
@@ -1507,7 +1507,8 @@ uint32_t TCGInterruptHandler(pushad_regs_t *regs, 
uint32_t esds,
                              regs->u.r32.edx);
                CLEAR_CF();
                break;
-       case 0x07:
+       case 0x07: {
+               uint32_t edx = regs->u.r32.edx;
                regs->u.r32.eax =
                  CompactHashLogExtendEvent32((unsigned char *)
                                                  ADDR_FROM_SEG_OFF(ES,
@@ -1516,9 +1517,11 @@ uint32_t TCGInterruptHandler(pushad_regs_t *regs, 
uint32_t esds,
                                              regs->u.r32.ebx,
                                              regs->u.r32.ecx,
                                              regs->u.r32.edx,
-                                             &regs->u.r32.edx);
+                                             &edx);
+               regs->u.r32.edx = edx;
                CLEAR_CF();
                break;
+       }
        default:
                SET_CF();
        }
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.