Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522AbcJAOyB (ORCPT ); Sat, 1 Oct 2016 10:54:01 -0400 Received: from mout.web.de ([212.227.17.12]:55265 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845AbcJAOxv (ORCPT ); Sat, 1 Oct 2016 10:53:51 -0400 Subject: [PATCH 08/15] md-cluster: Improve determination of sizes in read_resync_info() To: linux-raid@vger.kernel.org, Guoqing Jiang , Shaohua Li References: <566ABCD9.1060404@users.sourceforge.net> <3a03df66-92ce-20fb-17f3-fb79b9d43c8e@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <8319afa1-438c-03c7-3526-be25bc3171dd@users.sourceforge.net> Date: Sat, 1 Oct 2016 16:53:10 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <3a03df66-92ce-20fb-17f3-fb79b9d43c8e@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:HKVKIkniD1WOUFgdjxY5ssyBJTmtJXm5dHBHOYIr3R8n4mMXoxY 2bR+jDQuLystJVUnK8m6laeUXf40Orevq2IVog8uzTgmtlmCzsA6sknqNGW2hrnSANcDH8Z G9FcQC+x1bkl36+7tvM+HCKJmxSCEpnuy6//E592yCBL/r6brYS1u8F3Ig/lfrJ8khpRlaO PgT/cctnBrDkPfD0dfptQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:918vYDpAkss=:pnfE3T8tCVZrkw2E/bAs2L GqYDbdw1r9mIYrbF2ZOBxRbx+eGvTPnZJ3OF2mNw3oRShJmgx9rKzQuWT9KjmxScYZfga6Z68 QOjiibQBp44DjjlwkGRXyeERBVJcX5QUvONDcDTZlATnrsomHEuRgrPEmcditt30mrzoBDUFt meDob2E5goKOgU67dSxkA+qS9wjPQ/4pwnWI/a8UHT4Dq1ZfJKtuhX8ci2ySZzgoIPHeRLwuD FYzyvkAiNpMBBSAqOr0nJSG+Xsbj5SaO26H8CBxYRxuBwLdfJi5aeJnmP2mZs7LfR6i0LMN4d zJdEq+LlQVWZ4T2ZkOLWXGXTvjrR9L3vop52Rv1BqVTlmMMnq3dg5nTFL6barjbqff6dTW7GT kHSIxbKVlVfQrOSal5EoGSyk6wWD1lW+9yxGPNL4N0DlpfUckpCzjvF8yE2e+6XfxJQ9eiWFA /e6ecWRvl54IWwPpmfYX2dcjLzM2CHKlo61KzQI6XQlWDSufpkjhWPcuohX2L2NjzVzZLLnR9 xl9HdIDYU7o6iXhYBzx/uJSXZMqybvXDtwkNqbsff1Akv1iKYAXlebhNFpBUnKPyfZWSeba0x 91xYDrk2oE1Eu2VhwhHZGISTrlkDfd6pW0747r/IJMZ9UBWH6oVahDxaTSNWAQzk+1RAOoei9 Wpyc6kcVxFSDVZO4yD1NyTfmYqCyctXrG0IHLXMNwbPvOhKBABDiriFDmWxitJSWLyCBS2PMk lJ6On7s4VsMMgcVYeCiYyFvuKMaLFvLG6q7uc65c0XAf7HQSnQjigrko8tc+6LJnoPdOIwxRa q8vK5NI Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1113 Lines: 32 From: Markus Elfring Date: Sat, 1 Oct 2016 12:52:58 +0200 Replace the specification of data structures by either a pointer dereference or a variable name as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/md/md-cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index e965e78..0918108 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -275,10 +275,10 @@ static struct suspend_info *read_resync_info(struct mddev *mddev, struct dlm_loc sector_t hi = 0; dlm_lock_sync(lockres, DLM_LOCK_CR); - memcpy(&ri, lockres->lksb.sb_lvbptr, sizeof(struct resync_info)); + memcpy(&ri, lockres->lksb.sb_lvbptr, sizeof(ri)); hi = le64_to_cpu(ri.hi); if (hi > 0) { - s = kzalloc(sizeof(struct suspend_info), GFP_KERNEL); + s = kzalloc(sizeof(*s), GFP_KERNEL); if (!s) goto out; s->hi = hi; -- 2.10.0