lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7622b25c-a0d8-47b6-910b-9b2e42e099e4@intel.com>
Date: Fri, 19 Sep 2025 16:34:12 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Neeraj Kumar <s.neeraj@...sung.com>, linux-cxl@...r.kernel.org,
 nvdimm@...ts.linux.dev, linux-kernel@...r.kernel.org, gost.dev@...sung.com
Cc: a.manzanares@...sung.com, vishak.g@...sung.com, neeraj.kernel@...il.com,
 cpgs@...sung.com
Subject: Re: [PATCH V3 03/20] nvdimm/label: Modify nd_label_base() signature



On 9/17/25 6:40 AM, Neeraj Kumar wrote:
> nd_label_base() was being used after typecasting with 'unsigned long'. Thus
> modified nd_label_base() to return 'unsigned long' instead of 'struct
> nd_namespace_label *'
> 
> Signed-off-by: Neeraj Kumar <s.neeraj@...sung.com>
Reviewed-by: Dave Jiang <dave.jiang@...el.com>

Just a nit below:


> ---
>  drivers/nvdimm/label.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
> index 0a9b6c5cb2c3..668e1e146229 100644
> --- a/drivers/nvdimm/label.c
> +++ b/drivers/nvdimm/label.c
> @@ -271,11 +271,11 @@ static void nd_label_copy(struct nvdimm_drvdata *ndd,
>  	memcpy(dst, src, sizeof_namespace_index(ndd));
>  }
>  
> -static struct nd_namespace_label *nd_label_base(struct nvdimm_drvdata *ndd)
> +static unsigned long nd_label_base(struct nvdimm_drvdata *ndd)
>  {
>  	void *base = to_namespace_index(ndd, 0);
>  
> -	return base + 2 * sizeof_namespace_index(ndd);
> +	return (unsigned long) (base + 2 * sizeof_namespace_index(ndd));

Space is not needed between casting and the var. Also applies to other instances in this commit.

DJ

>  }
>  
>  static int to_slot(struct nvdimm_drvdata *ndd,
> @@ -284,7 +284,7 @@ static int to_slot(struct nvdimm_drvdata *ndd,
>  	unsigned long label, base;
>  
>  	label = (unsigned long) nd_label;
> -	base = (unsigned long) nd_label_base(ndd);
> +	base = nd_label_base(ndd);
>  
>  	return (label - base) / sizeof_namespace_label(ndd);
>  }
> @@ -293,7 +293,7 @@ static struct nd_namespace_label *to_label(struct nvdimm_drvdata *ndd, int slot)
>  {
>  	unsigned long label, base;
>  
> -	base = (unsigned long) nd_label_base(ndd);
> +	base = nd_label_base(ndd);
>  	label = base + sizeof_namespace_label(ndd) * slot;
>  
>  	return (struct nd_namespace_label *) label;
> @@ -684,7 +684,7 @@ static int nd_label_write_index(struct nvdimm_drvdata *ndd, int index, u32 seq,
>  			nd_label_next_nsindex(index))
>  		- (unsigned long) to_namespace_index(ndd, 0);
>  	nsindex->otheroff = __cpu_to_le64(offset);
> -	offset = (unsigned long) nd_label_base(ndd)
> +	offset = nd_label_base(ndd)
>  		- (unsigned long) to_namespace_index(ndd, 0);
>  	nsindex->labeloff = __cpu_to_le64(offset);
>  	nsindex->nslot = __cpu_to_le32(nslot);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ