mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00: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:
parent
fa55b7dcdc
commit
bc6e60a4fc
3 changed files with 3 additions and 3 deletions
|
@ -94,7 +94,7 @@ static struct audit_tree *alloc_tree(const char *s)
|
|||
{
|
||||
struct audit_tree *tree;
|
||||
|
||||
tree = kmalloc(sizeof(struct audit_tree) + strlen(s) + 1, GFP_KERNEL);
|
||||
tree = kmalloc(struct_size(tree, pathname, strlen(s) + 1), GFP_KERNEL);
|
||||
if (tree) {
|
||||
refcount_set(&tree->count, 1);
|
||||
tree->goner = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue