Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp492190lqt; Thu, 6 Jun 2024 09:18:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRuWVi5gHKb8AF5SoOkdMaLJkvRpfHo9X4nynqfP1a8WOtktkxvtsDsAZ3bdpuPD5TU0YK4JCMoiK31bCYcmaFr89VxvPvX5ZPZ0HDZA== X-Google-Smtp-Source: AGHT+IEnjw/chQVNkvx2cN359RSWX0F81Ld7c2WtuTTJ5pqav95XLSxNlWLnVRLt6owiy9GHVjwD X-Received: by 2002:a05:6602:1601:b0:7de:b218:58a4 with SMTP id ca18e2360f4ac-7eb571d4b7amr27214939f.3.1717690728746; Thu, 06 Jun 2024 09:18:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717690728; cv=pass; d=google.com; s=arc-20160816; b=UpBAt+/kivCSb3Dhk1VtE+JgE+1ANLG9irRIjHquMcJIWJD0R6q/KKSNLnffRAjWXH Wr6cqcx1FEvlRK4N/8cFEZGCxoVy4MIqHcAXv373w3b6nVoDN20D5Arsk/pGJuBaiPrT QUHY+ndm7L4n6uStoAD4/XLfOoTNY0YipKowlL+IQGbis1E/HXoQ7hZD7du5ZfwToOcq YxgyKnHQwbWd/ZJfBqAX+qsjURc4ZXOrw6UJZboBo00/4NlQh7uFcagEOKMzgBNAQGFw w7nYHzfy4J/cPkiD5oh+SkmiC4nkfbQOuIXs1Tbr1a45lqyJNzM7ViJFDfakKLbD4LZU FZvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=TISmpB8sBukzBAPyMdST1O+w11i+b8TfwHTY6d+fdo8=; fh=//QwBdR7sWMjb0IcVwkc6a1Yeh7U/8Di/7xaCJHkZoc=; b=UKZuBZ1Lp8TCPfFw4nPqb22WKn4HG9ghsYSatKcTVsIN+funkKnQFfCJ1MjdLUfrVt 8toPfzOwoSHdfCv/BI6D5wvtL0WCbHe6ySkf+2Dah3sqXnEISI9sBX8kqeBwt75fGbRV 51j89Dndc+e/4UCCQQK0eQ0rvGd4bN5eFH6BjAS78M+u4m2oW4T8YXYub31FFRYGrFOO aeGoAWlWljhzX8eKEnzB5wSeQ/htzsfmUEGaGNfFlfbc6q+dP/RiKQqEaaczvFJ1zGKU KfQulkPJID6Cf23nl6Hbu4hSqFJTvHPM26ZqJZrD0kcZGu9P4NV2d7Z6d4bvt11YcLD3 yXUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OaFXcok6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de27609acasi1378815a12.532.2024.06.06.09.18.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:18:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OaFXcok6; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204665-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204665-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DB11228168B for ; Thu, 6 Jun 2024 16:14:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78767198A21; Thu, 6 Jun 2024 16:11:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OaFXcok6" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 B4F85198843; Thu, 6 Jun 2024 16:11:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717690282; cv=none; b=pEnYKwDgmG2G5fg2M3uAxxr6NfvutpWp3spw+XMqy2qCdU8XL/w3m+tPw/grk3SogACfhOK3q1jw7xCAW8PJyQ5xPqFpxQdwXshgv19IIKdLMHyIjt120aKa/hDSCRXYf7974rc8RdHFVeWbBnMrn2tweMiyBCGQU8H0QOxc+9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717690282; c=relaxed/simple; bh=EouAagpep61jA1tkJh5qPmOHoRUQb4lmBEbh90kZRwc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IgVB0NoiLmEhUhj/+Hntj0UmDTIIBhKXBGYSLFFHEXorrbgfaxMpPcaI9DQJsCcfdwPKi+DO16OnhqD7iCudYysW4sfR+wFSEcx2AH0VKbNSo24MXD2VT/UolS/ePFz84aZM9BJ/rHS8uEs533i4GMKmh5pDdm4SQxHobuSnK4U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OaFXcok6; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717690280; x=1749226280; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=EouAagpep61jA1tkJh5qPmOHoRUQb4lmBEbh90kZRwc=; b=OaFXcok6n1CoL2KuGT7qrFwePOGmm9pO8VdRcQRYL7YmQZrE8Z5BeeDu Gg4NkCedxA9PfC2cRzLoJR1fq+DJOvRf9ohRp6Hcc64QCgrJ75OQfgEIy s0G6gY0yLcpqxw/YyucIM9ZXFX85LSBcFrEwbVst9GeMEEI7lGqgwzyy6 bMNCyWy5u7jHpHrfk8xVVZFniCwi+xpKyDvS6UHl12+IasLizwo5ByY9M Aut3JDleTxb9EVhyHoWii1BiSd9wlmOE1sruvBzIs1dikrxCRoFSjrybo eAG7069gX3Bxg2aZE04M0j/gcliRdYccmC2zuVHv+Fi0PZDAwDRy78vBy Q==; X-CSE-ConnectionGUID: DaCbEcIKQ9WBvfQnghl2uA== X-CSE-MsgGUID: CoeC/IGyS6GDanyThdC0Pg== X-IronPort-AV: E=McAfee;i="6600,9927,11095"; a="14525408" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="14525408" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:11:20 -0700 X-CSE-ConnectionGUID: LTzS1sx2QHC9CkgSFMHcfQ== X-CSE-MsgGUID: /kKnSnQoTwWrIAFgmczGpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="38696127" Received: from djiang5-mobl3.amr.corp.intel.com (HELO [10.125.109.168]) ([10.125.109.168]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 09:11:19 -0700 Message-ID: <4dd8ebe0-868d-4125-ad23-c5a8b5249ce9@intel.com> Date: Thu, 6 Jun 2024 09:11:17 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nvdimm/btt: use sizeof(*pointer) instead of sizeof(type) To: Erick Archer , Vishal Verma , Dan Williams , Ira Weiny , Kees Cook , "Gustavo A. R. Silva" , Justin Stitt Cc: nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: Content-Language: en-US From: Dave Jiang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/2/24 1:18 AM, Erick Archer wrote: > 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; >