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]
Date:	Thu, 10 Nov 2011 19:12:17 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Pavel Emelyanov <xemul@...allels.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	Glauber Costa <glommer@...allels.com>,
	Nathan Lynch <ntl@...ox.com>, Tejun Heo <tj@...nel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Serge Hallyn <serue@...ibm.com>,
	Daniel Lezcano <dlezcano@...ibm.com>
Subject: Re: [PATCH 2/3] pids: Split alloc_pidmap into parts

On 11/10, Pavel Emelyanov wrote:
>
> The map's page allocation code is moved to separate function
> to make clone-with-pids patching simpler.

Sorry for the really cosmetic nit, but I simply can't resist...

> +static int alloc_pidmap_page(struct pidmap *map)
> +{
> +	void *page = kzalloc(PAGE_SIZE, GFP_KERNEL);
> +
> +	/*
> +	 * Free the page if someone raced with us
> +	 * installing it:
> +	 */
> +	spin_lock_irq(&pidmap_lock);
> +	if (!map->page) {
> +		map->page = page;
> +		page = NULL;
> +	}
> +	spin_unlock_irq(&pidmap_lock);
> +	kfree(page);
> +
> +	return map->page ? 0 : -1;

Again, I won't insist, but "return !map->page" looks more readable.
Even better (imho) would be to return map->page, and change the
single caller to check "if (!alloc_pidnap_page())".

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ