[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4dd8ebe0-868d-4125-ad23-c5a8b5249ce9@intel.com>
Date: Thu, 6 Jun 2024 09:11:17 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Erick Archer <erick.archer@...look.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dan Williams <dan.j.williams@...el.com>, Ira Weiny <ira.weiny@...el.com>,
Kees Cook <keescook@...omium.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Justin Stitt <justinstitt@...gle.com>
Cc: nvdimm@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] nvdimm/btt: use sizeof(*pointer) instead of sizeof(type)
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 <erick.archer@...look.com>
Reviewed-by: Dave Jiang <dave.jiang@...el.com>
> ---
> 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;
>
Powered by blists - more mailing lists