From 57f9d9c84a9112d534fa90f2a6dad74bd71150b6 Mon Sep 17 00:00:00 2001 From: Zhao Liu Date: Tue, 21 Jan 2025 23:13:22 +0800 Subject: [PATCH] memattrs: Check the size of MemTxAttrs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Make sure MemTxAttrs is packed into 8 bytes and does not exceed 8 bytes. Suggested-by: Philippe Mathieu-Daudà Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250121151322.171832-3-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- include/exec/memattrs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h index 4fde4eee84..060b7e7131 100644 --- a/include/exec/memattrs.h +++ b/include/exec/memattrs.h @@ -64,6 +64,8 @@ typedef struct MemTxAttrs { uint16_t _reserved2; } MemTxAttrs; +QEMU_BUILD_BUG_ON(sizeof(MemTxAttrs) > 8); + /* Bus masters which don't specify any attributes will get this, * which has all attribute bits clear except the topmost one * (so that we can distinguish "all attributes deliberately clear" -- 2.30.2