[PATCH] lsm: align based on pointer length in lsm_fill_user_ctx()
Paul Moore
paul at paul-moore.com
Thu Nov 2 01:53:38 UTC 2023
Using the size of a void pointer is much cleaner than
BITS_PER_LONG / 8.
Signed-off-by: Paul Moore <paul at paul-moore.com>
---
security/security.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/security.c b/security/security.c
index 86f7a1995991..a808fd5eba6d 100644
--- a/security/security.c
+++ b/security/security.c
@@ -792,7 +792,7 @@ int lsm_fill_user_ctx(struct lsm_ctx __user *uctx, size_t *uctx_len,
size_t nctx_len;
int rc = 0;
- nctx_len = ALIGN(struct_size(nctx, ctx, val_len), BITS_PER_LONG / 8);
+ nctx_len = ALIGN(struct_size(nctx, ctx, val_len), sizeof(void *));
if (nctx_len > *uctx_len) {
rc = -E2BIG;
goto out;
--
2.42.0
More information about the Linux-security-module-archive
mailing list