lsm: align based on pointer length in lsm_fill_user_ctx()
authorPaul Moore <paul@paul-moore.com>
Wed, 1 Nov 2023 21:39:44 +0000 (17:39 -0400)
committerPaul Moore <paul@paul-moore.com>
Mon, 13 Nov 2023 03:54:42 +0000 (22:54 -0500)
Using the size of a void pointer is much cleaner than
BITS_PER_LONG / 8.

Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/security.c

index 86f7a19959910d4d455f8eb7744ae2467e015150..a808fd5eba6d43b8be0d11541ad77857e4918ba4 100644 (file)
@@ -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;