Commit 7264745d authored by Thorsten Blum's avatar Thorsten Blum Committed by Ilya Dryomov
Browse files

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: default avatarThorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 9852d85e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;