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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140422195421.GA2314@mtj.dyndns.org>
Date:	Tue, 22 Apr 2014 15:54:21 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jean Delvare <jdelvare@...e.de>,
	Monam Agarwal <monamagarwal123@...il.com>,
	Jeff Layton <jlayton@...hat.com>,
	Andreas Gruenbacher <agruen@...bit.com>,
	Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH 1/4] idr: proper invalid argument handling

Hello,

On Tue, Apr 22, 2014 at 06:16:18PM +0800, Lai Jiangshan wrote:
> @@ -457,8 +457,10 @@ int idr_alloc(struct idr *idr, void *ptr, int start, int end, gfp_t gfp_mask)
>  	/* sanity checks */
>  	if (WARN_ON_ONCE(start < 0))
>  		return -EINVAL;
> -	if (unlikely(max < start))
> +	if (unlikely(end > 0 && start == end))
>  		return -ENOSPC;
> +	if (WARN_ON_ONCE(max < start))
> +		return -EINVAL;

Why is this change necessary?  Now the code is inconsistent with the
comment?  This change looks very gratuituous.

> @@ -1078,14 +1077,17 @@ int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
>  	unsigned int max;
>  	unsigned long flags;
>  
> -	BUG_ON((int)start < 0);
> -	BUG_ON((int)end < 0);
> +	if (WARN_ON_ONCE((int)start < 0))
> +		return -EINVAL;
>  
> -	if (end == 0)
> -		max = 0x80000000;
> +	if ((int)end <= 0)
> +		max = INT_MAX;

Again, why are you changing this?  What problem are you trying to fix?

>  	else {
> -		BUG_ON(end < start);
>  		max = end - 1;
> +		if (unlikely(start == end))
> +			return -ENOSPC;
> +		if (WARN_ON_ONCE(max < start))
> +			return -EINVAL;

Please juts convert BUG_ON()s to WARNs.  If you want to change how the
paramters behave.  Do those in a separate patch with proper
rationales.

Thanks.

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