fs/afs: use struct_size() in kzalloc()

As Gustavo said in other patches doing the same replace, we can now
use the new struct_size() helper to avoid leaving these open-coded and
prone to type mistake.

Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
Zhengyuan Liu
2019-06-20 18:12:17 +01:00
committed by David Howells
parent 4521819369
commit ee102584ef
3 changed files with 4 additions and 8 deletions

View File

@@ -48,8 +48,7 @@ static int afs_fill_page(struct afs_vnode *vnode, struct key *key,
return 0;
}
req = kzalloc(sizeof(struct afs_read) + sizeof(struct page *),
GFP_KERNEL);
req = kzalloc(struct_size(req, array, 1), GFP_KERNEL);
if (!req)
return -ENOMEM;