From patchwork Fri Dec 29 11:37:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13506451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95322C46CD4 for ; Fri, 29 Dec 2023 11:37:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D4466B0098; Fri, 29 Dec 2023 06:37:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 35C296B0116; Fri, 29 Dec 2023 06:37:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FE1C6B0117; Fri, 29 Dec 2023 06:37:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0AFED6B0116 for ; Fri, 29 Dec 2023 06:37:53 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D4753A1A80 for ; Fri, 29 Dec 2023 11:37:52 +0000 (UTC) X-FDA: 81619656384.09.E06E546 Received: from mout.web.de (mout.web.de [212.227.17.12]) by imf09.hostedemail.com (Postfix) with ESMTP id C7B40140019 for ; Fri, 29 Dec 2023 11:37:50 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=web.de header.s=s29768273 header.b=dBX6iQY1; dmarc=pass (policy=quarantine) header.from=web.de; spf=pass (imf09.hostedemail.com: domain of Markus.Elfring@web.de designates 212.227.17.12 as permitted sender) smtp.mailfrom=Markus.Elfring@web.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703849871; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZBcHDfRSLylFhQXUZAokzd1uBYFMEXgVnKCdP0dordg=; b=UVYTgWh0vgrcEHeuvk+qloKSp/FrVxwJSbwfu3I6gWJMwIYOt5R4ErXCxSC2g/uTgmYR6R snOIgaiHYvMkFkM7gZ+FO+ObHlVuVOhSgBJ9udDr4UWzq5lyFHMyQ/d58+BJGzpV/gVgO0 MQ+Jdfd5pSJkG3v2/hQCB+flMKftjFw= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=web.de header.s=s29768273 header.b=dBX6iQY1; dmarc=pass (policy=quarantine) header.from=web.de; spf=pass (imf09.hostedemail.com: domain of Markus.Elfring@web.de designates 212.227.17.12 as permitted sender) smtp.mailfrom=Markus.Elfring@web.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703849871; a=rsa-sha256; cv=none; b=xBnCuoEvXvaY4hra0PmjhSPzHoAtRgxsQ4GNhCXfHGE/ynTqpVD1PPNHxtEOu9Gvx1gEaj pP3CRMN9EZyqvSPOaKCBA8RQJSwuBw+h/PTym3gpxuXKxwqBkxQJkxRMskqlwCr6Gf942C D1YM09MK6hEuCSXcN5N3xxDT8bz8OqY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703849868; x=1704454668; i=markus.elfring@web.de; bh=JBK+I0+RWpVt/64+ENmmEbIiZBHu+wn1RAw0cM1AQC0=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=dBX6iQY144i8JIIiPa4nd36mumgVF/Az+KjQopmtaAXxAjpSikitbAh1IRBBTNUp qcH+Su7ppyswZbkykOk50n8z89XEDKs9xUSyzUcojJ1EXJsH+RDCK1GYQjre8Q5xq WGP6wgdsTGR4mc0xvfViCs8bGSS0W9JgnjKAwCg2nPRF3zZ/0YKf/qacLrvG2maYp zm37ZQ5Y/VcbahcLJ7tFvInt0z513xcY4D6nNtEonBoGOjv3UYHNJ3aCpLoB+aDm8 XXi9m4amrIsP7U+KOibqeR1mQWvnnB669wB8hfgvygTpNozTQ9ntlKmjng0iF9pw3 9NmknIHHt9fG0LFT0A== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MLAVc-1raIMY3NSs-00IcLc; Fri, 29 Dec 2023 12:37:48 +0100 Message-ID: <8c9488b0-4d91-48ac-bee7-6454e3045a9f@web.de> Date: Fri, 29 Dec 2023 12:37:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/2] hugetlbfs: Improve a size determination in two functions Content-Language: en-GB From: Markus Elfring To: linux-mm@kvack.org, kernel-janitors@vger.kernel.org, Muchun Song Cc: LKML References: <9ce3f553-24bc-4ecd-ac5e-7ba27caeff57@web.de> In-Reply-To: <9ce3f553-24bc-4ecd-ac5e-7ba27caeff57@web.de> X-Provags-ID: V03:K1:0fmZJp4JlhAFSU+/KR4BIDEALzLIgB7Yzk/1jVkAKXarioNoWp9 LfcZBR4WpgfSElMkwfdr2Hs9mqEJru39lonItmW27YeBWTLgoLQv5uk2VGUbUrkIFQo9f8e kUvNv/9VOy0b6BPOdP3TZnzN9QOwe4PXoA7BShRlU/0L4Knx0fxD/fQ6q9h1fwhS6CM5c+e 6Sa9LHZEp/jeGlXjfkXRQ== UI-OutboundReport: notjunk:1;M01:P0:ZqJ9W1MrSY4=;WtGwAIo7u/RkWqQAQncXsE90bRH BY1hXtTWszVKpfsn9IXuZ1/drNGI8vdPYhksYrqm2FqtsJ21s43NtRoY/74V00TzYhdq801fG r8Mt4+GQb5O5Hv2YuaFqpYMnPmapVCdInlr5BfF3sCsDmkxfyCl9iCPhIzYxu3o5FVt2KgenO ldJIajCiKDsAi4LkEJRu0B8E0PuIY5TvlyzF5hQNjX88mqmkzHKRcBAJvUkZFPi+igx+/5dM9 SqSJZIU1z2wzjALREUOq8z9fz2a4DT7lSYfdbRqkaIHoONCgSKfdwEYI46FaQ5Q+mgUQmbcqr WB/s1HCx2al4jg2QNyFopRCCBqgckfnSPya0D+43x7229CCEaTTYnPL+7aXr6k7pC1qyA5bpU Vvy++aSrfP8zcOBVy1sg7JJvZ3ERZxvx5PkzeeGgjZ4ANhEHzE22tWfyUjtncDKQxr0jy5GC2 mJk/mUjvjH4Wgxx2aikUhUN6Fos30jIjtpDAvE+yA8SH7dWibs6BTs/+EbYZubqZhg+QsCwLJ 7zoE+bbo+uFOJnU9wW7FKE7diHFovRqil1qrB7fB1ZLs3s0jJC13QcjeWoLD1DVXi+KE+qlLr eqvsTdyWqrYujzOpv0cxhrex8JrLQtC1fuFGlcTwXLop5iOWsr395dGHniqH2vuDdiLBaoTDn BDIBOid11/fds3FWqi2krkYRTsXJH5fYxZfpDn36bRhO7aKL29f3b0n5M8agSE4CB/AmHQuAd hCQBLEyB0APFJBEDaCLMXrxLnpV3kl8+WsmoXYinAXXple2GYa9XjYrgFBICXpJo1O0Sm0WEC VNSmEUBHqRYihAKOXZJm3q2x6xWzmomwcJrV3TyzzJEKnaO92U1qPiXfUCa/XbmbM9Eb8pvR2 oj1pN/VoM/nbnQlKUf80n7GIAT2QMxsccxThZULMNgCjJ7/DIMYJC4ppeowW1pbyM0tFaVS97 cmuwnw== X-Rspam-User: X-Stat-Signature: amsh37w8dbsc83mzdecsgz1biyk85ikz X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C7B40140019 X-HE-Tag: 1703849870-797720 X-HE-Meta: U2FsdGVkX18eYey/D5qqiSyo0uD7UmWf9svs9ihz4/Gq2z1SweUtXBhpj4wNBnC368WG6nwG4gSPnuFBO20HyFIq98LXI/kTSrKE2skzzqZywvPnmrPStR3jLNIR8FFYrnmlmhp4I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ziyNYNhmGlxK7DPeSuMVsAOlKsycw7Q== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Markus Elfring Date: Fri, 29 Dec 2023 11:32:07 +0100 Replace the specification of data structures by pointer dereferences as the parameter for the operator “sizeof” to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Reviewed-by: Muchun Song --- fs/hugetlbfs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.43.0 diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ea5b8e57d904..24401a5046dd 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1460,7 +1460,7 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) struct hugetlbfs_fs_context *ctx = fc->fs_private; struct hugetlbfs_sb_info *sbinfo; - sbinfo = kmalloc(sizeof(struct hugetlbfs_sb_info), GFP_KERNEL); + sbinfo = kmalloc(sizeof(*sbinfo), GFP_KERNEL); if (!sbinfo) return -ENOMEM; sb->s_fs_info = sbinfo; @@ -1530,7 +1530,7 @@ static int hugetlbfs_init_fs_context(struct fs_context *fc) { struct hugetlbfs_fs_context *ctx; - ctx = kzalloc(sizeof(struct hugetlbfs_fs_context), GFP_KERNEL); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM;