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:00:22 +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 1/3] pids: Make alloc_pid return error

On 11/10, Pavel Emelyanov wrote:
>
> @@ -281,7 +281,7 @@ struct pid *alloc_pid(struct pid_namespace *ns)
>  {
>  	struct pid *pid;
>  	enum pid_type type;
> -	int i, nr;
> +	int i, nr = -ENOMEM;
>  	struct pid_namespace *tmp;
>  	struct upid *upid;

This doesn't look right at first glance... I mean, if
the first kmem_cache_alloc(ns->pid_cachep) fails, this -ENOMEM
won't be returned as ERR_PTR().

> @@ -321,7 +321,7 @@ out_free:
>  		free_pidmap(pid->numbers + i);
>
>  	kmem_cache_free(ns->pid_cachep, pid);
> -	pid = NULL;
> +	pid = ERR_PTR(nr);
>  	goto out;

Off-topic, but with or withoit this patch this "goto out" looks
strange imho. Why not a simple

	-	pid = NULL;
	-	goto out;
	+	return ERR_PTR(nr);

instead? But this is minor and subjective, I won't insist.

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