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: <43b0b4ad-69ac-450f-8b39-ae264355622e@intel.com>
Date: Mon, 11 Mar 2024 15:17:15 +0100
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Kory Maincent <kory.maincent@...tlin.com>, Jakub Kicinski
	<kuba@...nel.org>, Simon Horman <horms@...nel.org>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
CC: <thomas.petazzoni@...tlin.com>, Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH v3 net-next] ptp: Move from simple ida to xarray

On 3/11/24 14:59, Kory Maincent wrote:
> Move from simple ida to xarray for storing and loading the ptp_clock
> pointer. This prepares support for future hardware timestamp selection by
> being able to link the ptp clock index to its pointer.
> 
> Signed-off-by: Kory Maincent <kory.maincent@...tlin.com>
> ---
> 
> Change in v2:
> - Update an err value missing.
> 
> Change in v3:
> - Refactor err management.
> ---
>   drivers/ptp/ptp_clock.c | 28 ++++++++++++++++------------
>   1 file changed, 16 insertions(+), 12 deletions(-)
> 

sorry for not commenting more on v2 :/

As you change (the intent of*) underlying data structure you should also 
change included header file.

*ida is an xarray wrapper by now so the change is on semantic level only

> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index 3aaf1a3430c5..8eebf1373ca3 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -31,7 +31,7 @@ struct class *ptp_class;
>   
>   static dev_t ptp_devt;
>   
> -static DEFINE_IDA(ptp_clocks_map);
> +static DEFINE_XARRAY_ALLOC(ptp_clocks_map);
>   
>   /* time stamp event queue operations */
>   
> @@ -201,7 +201,7 @@ static void ptp_clock_release(struct device *dev)
>   	bitmap_free(tsevq->mask);
>   	kfree(tsevq);
>   	debugfs_remove(ptp->debugfs_root);
> -	ida_free(&ptp_clocks_map, ptp->index);
> +	xa_erase(&ptp_clocks_map, ptp->index);
>   	kfree(ptp);
>   }
>   
> @@ -241,16 +241,16 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
>   		return ERR_PTR(-EINVAL);
>   
>   	/* Initialize a clock structure. */
> -	err = -ENOMEM;

you could remove 0-init of err in this commit too

>   	ptp = kzalloc(sizeof(struct ptp_clock), GFP_KERNEL);
> -	if (ptp == NULL)
> +	if (!ptp) {
> +		err = -ENOMEM;
>   		goto no_memory;
> +	}
>   

[snip]

Thanks a lot!
Only nitpicks left, so:
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ