aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/file.c
diff options
context:
space:
mode:
authorZhengyuan Liu <liuzhengyuan@kylinos.cn>2019-06-20 18:12:17 +0100
committerDavid Howells <dhowells@redhat.com>2019-06-20 18:12:17 +0100
commitee102584efd53547bf9a0810e80b56f99f4a9105 (patch)
treecd995a1511e4aa4c9ef6d2a488795d5a5b670693 /fs/afs/file.c
parent452181936931f0f08923aba5e04e1e9ef58c389f (diff)
downloadlinux-ee102584efd53547bf9a0810e80b56f99f4a9105.tar.gz
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/file.c')
-rw-r--r--fs/afs/file.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/afs/file.c b/fs/afs/file.c
index 11e69c5fb7abb5..67cd782a1c64f8 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -314,8 +314,7 @@ int afs_page_filler(void *data, struct page *page)
/* fall through */
default:
go_on:
- req = kzalloc(sizeof(struct afs_read) + sizeof(struct page *),
- GFP_KERNEL);
+ req = kzalloc(struct_size(req, array, 1), GFP_KERNEL);
if (!req)
goto enomem;
@@ -465,8 +464,7 @@ static int afs_readpages_one(struct file *file, struct address_space *mapping,
n++;
}
- req = kzalloc(sizeof(struct afs_read) + sizeof(struct page *) * n,
- GFP_NOFS);
+ req = kzalloc(struct_size(req, array, n), GFP_NOFS);
if (!req)
return -ENOMEM;