From ee102584efd53547bf9a0810e80b56f99f4a9105 Mon Sep 17 00:00:00 2001 From: Zhengyuan Liu Date: Thu, 20 Jun 2019 18:12:17 +0100 Subject: 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 Signed-off-by: David Howells --- fs/afs/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/afs/dir.c') diff --git a/fs/afs/dir.c b/fs/afs/dir.c index e8c58c94eb61..5dff607a08f9 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -242,8 +242,7 @@ retry: if (nr_inline > (PAGE_SIZE - sizeof(*req)) / sizeof(struct page *)) nr_inline = 0; - req = kzalloc(sizeof(*req) + sizeof(struct page *) * nr_inline, - GFP_KERNEL); + req = kzalloc(struct_size(req, array, nr_inline), GFP_KERNEL); if (!req) return ERR_PTR(-ENOMEM); -- cgit v1.2.3-58-ga151