mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
@@ -637,7 +637,7 @@ static struct audit_rule_data *audit_krule_to_data(struct audit_krule *krule)
|
||||
void *bufp;
|
||||
int i;
|
||||
|
||||
data = kmalloc(sizeof(*data) + krule->buflen, GFP_KERNEL);
|
||||
data = kmalloc(struct_size(data, buf, krule->buflen), GFP_KERNEL);
|
||||
if (unlikely(!data))
|
||||
return NULL;
|
||||
memset(data, 0, sizeof(*data));
|
||||
|
Reference in New Issue
Block a user