diff mbox

[06/13] hdata: Reduce 'struct HDIF_array_hdr' alignment to 4 bytes

Message ID 20170823072123.18769-7-stewart@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith Aug. 23, 2017, 7:21 a.m. UTC
UBSan threw up the following:
hdata/test/../hdif.c:96:9: runtime error: member access within misaligned address 0x7f9ad8b02c18 for type 'const struct HDIF_array_hdr', which requires 16 byte alignment
0x7f9ad8b02c18: note: pointer points here
 00 00 00 00  00 00 00 10 00 00 00 08  00 00 00 14 00 00 00 14  00 00 00 20 00 00 00 00  80 03 ff ff
              ^

Real data we're parsing doesn't enforce that alignment requirement,
so we shouldn't rely on it.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 hdata/hdif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/hdata/hdif.h b/hdata/hdif.h
index ef03522aca8b..22345b368eca 100644
--- a/hdata/hdif.h
+++ b/hdata/hdif.h
@@ -44,7 +44,7 @@  struct HDIF_array_hdr {
 	__be32	ecnt;
 	__be32	esize;
 	__be32	eactsz;
-} __packed __align(0x10);
+} __packed __align(0x4);
 
 struct HDIF_child_ptr {
 	__be32	offset;