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:	Mon, 22 Apr 2013 20:34:41 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Chen Gang <gang.chen@...anux.com>
CC:	David Miller <davem@...emloft.net>,
	"dhowells@...hat.com" <dhowells@...hat.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Serge Hallyn <serge.hallyn@...onical.com>,
	netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] Net: rxrpc: signed and unsigned issue, need type cast
 for n_elem.

On Mon, 2013-04-22 at 18:24 +0800, Chen Gang wrote:
> n_elem is unsigned int which never < 0.
>   but it seems, we realy need check it whether < 0.
>   so need a type cast for it.
> 
>   find it by EXTRA_CFLAGS=-W
> 
> 
> Signed-off-by: Chen Gang <gang.chen@...anux.com>
> ---
>  net/rxrpc/ar-key.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c
> index 7633a75..ba0b722 100644
> --- a/net/rxrpc/ar-key.c
> +++ b/net/rxrpc/ar-key.c
> @@ -346,7 +346,7 @@ static int rxrpc_krb5_decode_tagged_array(struct krb5_tagged_data **_td,
>  
>  	n_elem = ntohl(*xdr++);
>  	toklen -= 4;
> -	if (n_elem < 0 || n_elem > max_n_elem)
> +	if ((int)n_elem < 0 || n_elem > max_n_elem)

(int)n_elem < 0 is equivalent to n_elem >= 0x80000000, and if that is
true then n_elem > max_n_elem (because max_n_elem <= 0xff).

Ben.

>  		return -EINVAL;
>  	*_n_elem = n_elem;
>  	if (n_elem > 0) {

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ