summaryrefslogtreecommitdiff
path: root/fs/ceph
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@toblux.com>2024-09-12 17:39:24 +0200
committerIlya Dryomov <idryomov@gmail.com>2024-10-03 09:31:08 +0200
commit7264745d55422dbe53b5e75ddec622ab5d1290cb (patch)
tree92100c1d67f370e91fb4f0e23432352773328aef /fs/ceph
parent9852d85ec9d492ebef56dc5f229416c925758edc (diff)
downloadlwn-7264745d55422dbe53b5e75ddec622ab5d1290cb.tar.gz
lwn-7264745d55422dbe53b5e75ddec622ab5d1290cb.zip
ceph: use struct_size() helper in __ceph_pool_perm_get()
Use struct_size() to calculate the number of bytes to be allocated. Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/addr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 53fef258c2bc..1d97a53d1b29 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -2145,7 +2145,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
}
pool_ns_len = pool_ns ? pool_ns->len : 0;
- perm = kmalloc(sizeof(*perm) + pool_ns_len + 1, GFP_NOFS);
+ perm = kmalloc(struct_size(perm, pool_ns, pool_ns_len + 1), GFP_NOFS);
if (!perm) {
err = -ENOMEM;
goto out_unlock;