From patchwork Sun Jun 2 08:18:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erick Archer X-Patchwork-Id: 13682720 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04olkn2051.outbound.protection.outlook.com [40.92.75.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 152CA1CAA6; Sun, 2 Jun 2024 08:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.75.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717316330; cv=fail; b=IH+Lx27ZnKpHzWmJ8Jfiz6zIORyYKuC0AEwxatW/gSZkrM7Ttj6Z4K9k89DpXRtFMyHlVTxYv5HhoRrt8tl8KT6gA+jB7rfC3YEa/emYXGkWncemyCKBL1kXcNiV99THdD4sH6adnC5wJHLAO4uMlOlsbb4DpTdAVQwxY68m/8c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717316330; c=relaxed/simple; bh=RVLSh558LEQUCGew58xaBnwmWcm/TdYO/JJX8HpSq6Y=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=OnmLnm3raLQpvAAebh9FDlkOvoSwVvA7ZHN3DM03emf2riilp39Zch61aiqC8StDXulvySaP/Fo9kEpKvt/D5qD6QKgTwoa4Y9p1q7Uxu5yHNt2nTxIRH6TpqTiMlkmi/QKAp0XlibEiZk4qetm53wLqYvGiJ5GqnCBkDeKG77k= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=ZCUWoacO; arc=fail smtp.client-ip=40.92.75.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="ZCUWoacO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bLAXJnbsBzbfewKdJ8CvmE19FmwpaxdipmZP60klf6eN3BWjuKsTO2A65MbmwJhYsbXLPWbjcA6DlgfMItRI+KUwqHRmtaR4KqiKlPWNbobt2UM45JigC7UwfuG2gQvwY0ejpmHOCWWmTwbKMyO5TY00MTox3BHaY2CSK1aEkyndjOTx1N2nInSF/v76yBK5kmGS2umlOFisVkRYXhA63DgqDX1kj3ZGxUcekbmd60jZddDvHE3+MY8QIenNw7yYbCBsqu4gdh46dZrRek2/LdmMdqP6f2WuXuSBRQr5KPAIo2+RKRo0xJvvo/4kqOoqPEtV/JLt2nP+1m6zplQTmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YZMGFTuKJtqHfCuTi1jhKwZDUrlLhH4uVis8rjYKUoM=; b=P3RgK4DXNhrED99Yq1TFD9S70sRg4q4dLtxQnYu3In0H4kOfJOI+0IgB8VWeyXdTAAiCbVbHSEmGYA9glfU7cFVjjiMo7kwBwNyVJrYax/yMBZNXK60vCjM2fuXKAa5TLA+HpAVwq0P1nTo4SF4tmzI5oOwz6N4dDIejU0c2dM/0WOQf7bhwDpzo2VR6Kbi6G6wln1W/Y8shLtftG/LuI8kdIYcrdGIxb5v6urTI0B8BGrLyQEwBc+tPXnNwgCJOlW/R75wXdRVmzVpkS5632VBfvja42nN+W89DChueaSNZliCQn3xcm9skzKMj4G4Gq0Bood5ANBAdGwlbSCMKjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YZMGFTuKJtqHfCuTi1jhKwZDUrlLhH4uVis8rjYKUoM=; b=ZCUWoacOEtse0SxZPf4pg24M4OpBKdCNWCWGmU2WQ8FOxSRBi9jdKDPOFLZo59yTfnb+4brzf8uODuCMj5AJWeD/ZulwZr7qERo1ZGZSd8gscSr9iotsisg6DuByENyE9F9ZcS3UnKCeJ3VhphyVY/mv9mnRdpOLDMT2dZo/aXKdhDJMxGUtBSlf4sruDU9peDEux4YJYJ1QsgJo+n0WpjtWAXxQBCnqFY68pejyr+dIchnz/U2R+VhfMc0gPrxikntSdboIrC4YnmQAhjMW1WRWmRAFdQWfAlmAImvpglrJps+oRC3itwsr5nm5j+gvoRhUZVL2YipeWI95VyhCeA== Received: from AS8PR02MB7237.eurprd02.prod.outlook.com (2603:10a6:20b:3f1::10) by DU2PR02MB10207.eurprd02.prod.outlook.com (2603:10a6:10:46d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Sun, 2 Jun 2024 08:18:43 +0000 Received: from AS8PR02MB7237.eurprd02.prod.outlook.com ([fe80::409b:1407:979b:f658]) by AS8PR02MB7237.eurprd02.prod.outlook.com ([fe80::409b:1407:979b:f658%5]) with mapi id 15.20.7633.021; Sun, 2 Jun 2024 08:18:43 +0000 From: Erick Archer To: Vishal Verma , Dan Williams , Dave Jiang , Ira Weiny , Kees Cook , "Gustavo A. R. Silva" , Justin Stitt Cc: Erick Archer , nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] nvdimm/btt: use sizeof(*pointer) instead of sizeof(type) Date: Sun, 2 Jun 2024 10:18:23 +0200 Message-ID: X-Mailer: git-send-email 2.25.1 X-TMN: [u8DozTSoAjZnmjIBqh8TQse2TGCPkhDa] X-ClientProxiedBy: MA4P292CA0009.ESPP292.PROD.OUTLOOK.COM (2603:10a6:250:2d::6) To AS8PR02MB7237.eurprd02.prod.outlook.com (2603:10a6:20b:3f1::10) X-Microsoft-Original-Message-ID: <20240602081823.7297-1-erick.archer@outlook.com> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR02MB7237:EE_|DU2PR02MB10207:EE_ X-MS-Office365-Filtering-Correlation-Id: 87b51c5a-de56-44ff-5306-08dc82dc9dfa X-Microsoft-Antispam: BCL:0;ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: c/lxDm9FuiMut7tS/vXpPRy+XlmWRG9D57HOg8ndnJ1R5tvE2900DftH5tZETQTaEWwAurCxLSNA+6pU61w9gr4yJJ3ZGHk2wAiFU/Ec+ReP1Kyv4CF+ZMMYTLW9dzsOlcODZ1PQBaCyd1laoKxmdMFXQjUmn3hFpXxck9Z4X2Nd7uwehKmEsWQdszzSuIw4X1bh9ZKp2SV1BNADB+T3nHdsXdvRtfAjcfajGyovSx0rgaRQOP6EThcuV2Oll2O9Mn8y+fn2DiXOTCK1PaWYG/pxyRgUg6qnXbbsjS0p1JYLrkAm7L+2CN4IUkMVmTcSJHhdviZ4UB/gtjOq9BlvIJYdYnm7bifbePbS46TQ6fMcdhOFzumBbOZ+BeBdhmuwGYXzNNVVa4Y2hy/2whrCU03nkrgGF43i2Z8nwB2PE2hfDTjQ8/s6JBz9eDNYDXlmaQk7TJZQPsMMEZeC9iYKePOrTumStTnpenjvFuebHIM0JFlJ5pD3o1tOYLVrhNzihS0RUWmspspQ0tAUyJm29Ki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nn/zupGfXH+4ANu9/hA68Nl4QhvnnZr6G9ePEG3BrWPxMsYhH24ThG+YNF2nNgDcUzFC2zHIvaoQqfzB3cGWVZGX0FgsyPRR3o09aA9lTbzcwczYtyIJr3QR+Mvjha6X7tYe97Ms2l6CHlJC26zbq4tPrNewZEiKw5E1DQcEJTltHWxooqPOm8oBQKtfGkQ+OltlTFh7x9FmjfIVG0gE4HqB62ooSS8FsRITG8xM/wgsqt32BuTYD19uhPx/e9QS86v/WVoLqxW6YoWvnE9JDMPEmzxeYt6akO4rPak6Upw90gtswzmrr+tKUJ8VMU4zO8c9+eJYIkaWk2VOj+Hm8BJylKHomGdGp X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87b51c5a-de56-44ff-5306-08dc82dc9dfa X-MS-Exchange-CrossTenant-AuthSource: AS8PR02MB7237.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2024 08:18:43.7433 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR02MB10207 It is preferred to use sizeof(*pointer) instead of sizeof(type) due to the type of the variable can change and one needs not change the former (unlike the latter). This patch has no effect on runtime behavior. Signed-off-by: Erick Archer Reviewed-by: Dave Jiang --- drivers/nvdimm/btt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 1e5aedaf8c7b..b25df8fa8e8e 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -751,7 +751,7 @@ static struct arena_info *alloc_arena(struct btt *btt, size_t size, u64 logsize, mapsize, datasize; u64 available = size; - arena = kzalloc(sizeof(struct arena_info), GFP_KERNEL); + arena = kzalloc(sizeof(*arena), GFP_KERNEL); if (!arena) return NULL; arena->nd_btt = btt->nd_btt; @@ -978,7 +978,7 @@ static int btt_arena_write_layout(struct arena_info *arena) if (ret) return ret; - super = kzalloc(sizeof(struct btt_sb), GFP_NOIO); + super = kzalloc(sizeof(*super), GFP_NOIO); if (!super) return -ENOMEM;