Skip to content

Commit 7264745

Browse files
tobluxidryomov
authored andcommitted
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 <[email protected]> Reviewed-by: Ilya Dryomov <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 9852d85 commit 7264745

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ceph/addr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
21452145
}
21462146

21472147
pool_ns_len = pool_ns ? pool_ns->len : 0;
2148-
perm = kmalloc(sizeof(*perm) + pool_ns_len + 1, GFP_NOFS);
2148+
perm = kmalloc(struct_size(perm, pool_ns, pool_ns_len + 1), GFP_NOFS);
21492149
if (!perm) {
21502150
err = -ENOMEM;
21512151
goto out_unlock;

0 commit comments

Comments
 (0)