[PATCH v2 2/2] memattrs: Check the size of MemTxAttrs

Zhao Liu posted 2 patches 1 day, 12 hours ago
[PATCH v2 2/2] memattrs: Check the size of MemTxAttrs
Posted by Zhao Liu 1 day, 12 hours ago
Make sure MemTxAttrs is packed into 8 bytes and does not exceed 8 bytes.

Suggested-by: Philippe Mathieu-Daudà <philmd@linaro.org>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
Changes since v1:
 * Since MemTxAttrs has been well pakced as 8 bytes, only check if it
   exceed 8 bytes.
---
 include/exec/memattrs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
index 4fde4eee8439..060b7e713149 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.34.1