From patchwork Sat Jun 23 12:55:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 10483617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8774E60230 for ; Sat, 23 Jun 2018 12:56:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80CAB28D36 for ; Sat, 23 Jun 2018 12:56:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 759C528D4C; Sat, 23 Jun 2018 12:56:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ED3A28D36 for ; Sat, 23 Jun 2018 12:56:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751897AbeFWM4B (ORCPT ); Sat, 23 Jun 2018 08:56:01 -0400 Received: from mout.gmx.net ([212.227.17.21]:53915 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751787AbeFWM4A (ORCPT ); Sat, 23 Jun 2018 08:56:00 -0400 Received: from localhost.localdomain ([122.224.77.194]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LaKaw-1ftRS80Dte-00m58T; Sat, 23 Jun 2018 14:55:54 +0200 From: Chengguang Xu To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com, idryomov@gmail.com, Chengguang Xu Subject: [PATCH 2/3] ceph: change hard coded size to sizeof(u32) in ceph_pre_init_acls() Date: Sat, 23 Jun 2018 20:55:23 +0800 Message-Id: <20180623125524.29233-2-cgxu519@gmx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180623125524.29233-1-cgxu519@gmx.com> References: <20180623125524.29233-1-cgxu519@gmx.com> X-Provags-ID: V03:K1:exZU8W1BNTysBuQ/iuhK3aHw24ZWjl9HzMlZNU8wGdckD5BKhRa /onyY5qUf0eNVlNRAHSuhii3XnrsbXITYkk8Efxcp0BO/csT2QbSI3aa5J0jurYGblCV1V1 29VST8P2qyr+ssgrhHaotp9t7XdZWK7FPkr0kPga142eqW3uB0qSHgr771NIPv/cGvdhaJp FyKhy47u5fb1Dh65hBFPw== X-UI-Out-Filterresults: notjunk:1; V01:K0:6VUg6ES+gus=:RoqJk7SCUub/JNA4LX39rM FGNsEKLzVQPQE82l2QOhcJPA22xhtb9WbTVVXXx7UbZizQhwllzQB/5rs5cT6lOdbPKl2KRTt P9+QDs6LKyA9s8vpbSlGcKbQBIP1/rSdvG7ouusEjGUYt37G5d0GTOrar2opsC3owta4ygTXm kzyWATZfOWyDf4CCOSRJq7dZvGN9kr2Mq4Wx1B3Yry8H84fN7Zbjgh+Brjo5db/s93ZzyB1D0 8DP22YAKqW7TkO+vs33L/+G+4GH/SBCtOtCo7afpCR45oluzSqmMc7M9Ni4vBwaxpF4Tu7Qfl jIIFoDaJpg7POBzI9tErqL9qI35QtTpOrwU8CoQAO2kXe/+MSoQ867cMvwezRAfK76wS/V32c wV+AuDIenYGmrFG1dIsSk8TuDbtdFJmSgqdNP6QnMFWN+YAMioCEhsMmWbLGSgcNmjwVD10wv p3i9lmPUzE4deVhDkMcMPxi0a1KBg37zLzd3bXUFR6Mn1IzG4huBivDVFJnTuT9pamyeznLHx WBbEag8oO5A+EZJk21+xI6qQtBBN5iWO8bnRfmtHT/HWCYSduz4/SkFKLfvM/RRJdcPSO+Nt8 +WIMiGDiHte94tTlskXjseUQc3s0oEetvktydAG4Qc/iZKFbaoJQV3AtJmZ1x7OK9X8+lhVTm p9SnF6y27Hg9AZo8rjQHsx9Sgdr+wvAyHrPg6r5D4AWHth5ZtwK5pOya+A1sdNiGEz3ZBS9iU 6i7J6mxBERcsMusolHlhaa+ijaddXi85e8jkgM9aRppfHKOp/o7q7UiKmJ8= Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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,