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: <20240308210745.GE603911@kernel.org>
Date: Fri, 8 Mar 2024 21:07:45 +0000
From: Simon Horman <horms@...nel.org>
To: Kory Maincent <kory.maincent@...tlin.com>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, thomas.petazzoni@...tlin.com,
	Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH net-next] ptp: Move from simple ida to xarray

On Thu, Mar 07, 2024 at 11:03:26AM +0100, 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>

..

> @@ -246,11 +246,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
>  	if (ptp == NULL)
>  		goto no_memory;
>  
> -	index = ida_alloc_max(&ptp_clocks_map, MINORMASK, GFP_KERNEL);
> -	if (index < 0) {
> -		err = index;
> +	err = xa_alloc(&ptp_clocks_map, &index, ptp, xa_limit_31b,
> +		       GFP_KERNEL);
> +	if (err)
>  		goto no_slot;
> -	}
>  
>  	ptp->clock.ops = ptp_clock_ops;
>  	ptp->info = info;

Hi Kory,

Prior to this change err was -ENOMEM at this point. Now it is 0.

And The immediately following code is:

	ptp->devid = MKDEV(major, index);
	ptp->index = index;
	INIT_LIST_HEAD(&ptp->tsevqs);
	queue = kzalloc(sizeof(*queue), GFP_KERNEL);
	if (!queue)
		goto no_memory_queue;

The goto above results in:

	return ERR_PTR(err);

But here err is 0. This does not seem correct.

Flagged by Smatch.

..

-- 
pw-bot: changes-requested

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ