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: <20100906094555.C8BB.A69D9226@jp.fujitsu.com>
Date:	Mon,  6 Sep 2010 09:48:51 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	Kulikov Vasiliy <segooon@...il.com>
Cc:	kosaki.motohiro@...fujitsu.com, kernel-janitors@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Rientjes <rientjes@...gle.com>,
	Minchan Kim <minchan.kim@...il.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 14/14] mm: oom_kill: use IS_ERR() instead of strict checking

> From: Vasiliy Kulikov <segooon@...il.com>
> 
> Use IS_ERR() instead of strict checking.

Umm...

I don't like this. IS_ERR() imply an argument is error code. but in
this case, we don't use error code. -1 mean oom special purpose meaning
value.

So, if we take this direction, It would be better to use EAGAIN or something
instead -1.



> 
> Signed-off-by: Vasiliy Kulikov <segooon@...il.com>
> ---
>  Compile tested.
> 
>  mm/oom_kill.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index fc81cb2..2ee3350 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -514,7 +514,7 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
>  	read_lock(&tasklist_lock);
>  retry:
>  	p = select_bad_process(&points, limit, mem, NULL);
> -	if (!p || PTR_ERR(p) == -1UL)
> +	if (IS_ERR_OR_NULL(p))
>  		goto out;
>  
>  	if (oom_kill_process(p, gfp_mask, 0, points, limit, mem, NULL,
> @@ -691,7 +691,7 @@ retry:
>  	p = select_bad_process(&points, totalpages, NULL,
>  			constraint == CONSTRAINT_MEMORY_POLICY ? nodemask :
>  								 NULL);
> -	if (PTR_ERR(p) == -1UL)
> +	if (IS_ERR(p))
>  		goto out;
>  
>  	/* Found nothing?!?! Either we hang forever, or we panic. */
> -- 
> 1.7.0.4
> 



--
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