aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorXiu Jianfeng <xiujianfeng@huawei.com>2021-12-14 19:48:54 +0800
committerPaul Moore <paul@paul-moore.com>2021-12-14 17:39:42 -0500
commitbc6e60a4fc1daef2d95367fea8ee74fc5b62b7d6 (patch)
tree0cfc61274ea2b8a6b19a8862b59fb1b67935d32b /kernel/audit.c
parentLinux 5.16-rc1 (diff)
downloadlinux-dev-bc6e60a4fc1daef2d95367fea8ee74fc5b62b7d6.tar.xz
linux-dev-bc6e60a4fc1daef2d95367fea8ee74fc5b62b7d6.zip
audit: use struct_size() helper in kmalloc()
Make use of struct_size() helper instead of an open-coded calucation. Link: https://github.com/KSPP/linux/issues/160 Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 121d37e700a6..0117e7d947fd 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1446,7 +1446,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
if (err)
return err;
}
- sig_data = kmalloc(sizeof(*sig_data) + len, GFP_KERNEL);
+ sig_data = kmalloc(struct_size(sig_data, ctx, len), GFP_KERNEL);
if (!sig_data) {
if (audit_sig_sid)
security_release_secctx(ctx, len);