On 06/24/2018 04:49 PM, Ilya Dryomov wrote:
On Sat, Jun 23, 2018 at 2:55 PM Chengguang Xu <cgxu519@xxxxxxx> wrote:
Though val_size1/val_size2 are both type sizt_t but
ceph_pagelist_encode_string() can only handle string
size max to U32_MAX, so change hardcode 8 to sizeof(u32).
Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx>
---
fs/ceph/acl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c
index 3351ea14390b..f736108604a6 100644
--- a/fs/ceph/acl.c
+++ b/fs/ceph/acl.c
@@ -219,7 +219,8 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
if (acl) {
size_t len = strlen(XATTR_NAME_POSIX_ACL_ACCESS);
- err = ceph_pagelist_reserve(pagelist, len + val_size1 + 8);
+ err = ceph_pagelist_reserve(pagelist, len + val_size1 +
+ sizeof(u32));
if (err)
goto out_err;
ceph_pagelist_encode_string(pagelist, XATTR_NAME_POSIX_ACL_ACCESS,
@@ -233,7 +234,8 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
}
if (default_acl) {
size_t len = strlen(XATTR_NAME_POSIX_ACL_DEFAULT);
- err = ceph_pagelist_reserve(pagelist, len + val_size2 + 8);
+ err = ceph_pagelist_reserve(pagelist, len + val_size2 +
+ sizeof(u32));
if (err)
goto out_err;
err = ceph_pagelist_encode_string(pagelist,
This is wrong. In both cases it reserves pages for two string-like
things, str_size + 4 each, for a total of str_size1 + str_size2 + 8.
Ah, yes. Could we change to sizeof(u32) + sizeof(u32) instead?
Thanks,
Chengguang.
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html