summaryrefslogtreecommitdiffstats
path: root/fs/afs/dir.c
diff options
context:
space:
mode:
authorZhengyuan Liu2019-06-20 19:12:17 +0200
committerDavid Howells2019-06-20 19:12:17 +0200
commitee102584efd53547bf9a0810e80b56f99f4a9105 (patch)
treecd995a1511e4aa4c9ef6d2a488795d5a5b670693 /fs/afs/dir.c
parentafs: Trace afs_server usage (diff)
downloadkernel-qcow2-linux-ee102584efd53547bf9a0810e80b56f99f4a9105.tar.gz
kernel-qcow2-linux-ee102584efd53547bf9a0810e80b56f99f4a9105.tar.xz
kernel-qcow2-linux-ee102584efd53547bf9a0810e80b56f99f4a9105.zip
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>
Diffstat (limited to 'fs/afs/dir.c')
-rw-r--r--fs/afs/dir.c3
1 files changed, 1 insertions, 2 deletions
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);