[PATCH] lsm: update the BUILD_BUG_ON() in audit_log_lsm_data()

Paul Moore <[email protected]>
Newsgroups gmane.linux.kernel.lsm
Message-ID <[email protected]>
On 32-bit systems the newly added namespace fields in the
common_audit_data struct exceed the BUILD_BUG_ON(sizeof(void *) * 2)
size check in audit_log_lsm_data().  Convert the size check to two
u64 types to both fit the new fields and move to a size that is not
architecture dependent.

Fixes: bb20ca26f960 ("lsm: add LSM_AUDIT_DATA_NS for namespace audit records")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Paul Moore <[email protected]>
---
 security/lsm_audit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 404ccbbbf94c..29116ef2986b 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -182,7 +182,7 @@ void audit_log_lsm_data(struct audit_buffer *ab,
 	 * start making this union too large!  See struct lsm_network_audit
 	 * as an example of how to deal with large data.
 	 */
-	BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2);
+	BUILD_BUG_ON(sizeof(a->u) > (sizeof(u64) * 2));
 
 	switch (a->type) {
 	case LSM_AUDIT_DATA_NONE:
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.