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] [day] [month] [year] [list]
Date:	Wed, 05 Jan 2011 15:30:42 -0800
From:	"Venkateswararao Jujjuri (JV)" <jvrao@...ux.vnet.ibm.com>
To:	"M. Mohan Kumar" <mohan@...ibm.com>
CC:	v9fs-developer <v9fs-developer@...ts.sourceforge.net>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [V9fs-developer] [PATCH] net/9p: Use proper data types

On 1/5/2011 8:53 AM, M. Mohan Kumar wrote:
> Use proper data types for storing the count of the binary blob and
> length of a string. Without this patch length calculation of string will
> always result in -1 because of comparision between signed and unsigned
> integer.
> 
> Signed-off-by: M. Mohan Kumar <mohan@...ibm.com>
> ---
>  net/9p/protocol.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/9p/protocol.c b/net/9p/protocol.c
> index c5180fd..2902eb1 100644
> --- a/net/9p/protocol.c
> +++ b/net/9p/protocol.c
> @@ -234,14 +234,14 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
>  			}
>  			break;
>  		case 'D':{
> -				int32_t *count = va_arg(ap, int32_t *);
> +				uint32_t *count = va_arg(ap, int32_t *);

uinit32_t * inside the va_arg also to be consistent?
>  				void **data = va_arg(ap, void **);
> 
>  				errcode =
>  				    p9pdu_readf(pdu, proto_version, "d", count);
>  				if (!errcode) {
>  					*count =
> -					    min_t(int32_t, *count,
> +					    min_t(uint32_t, *count,
>  						  pdu->size - pdu->offset);
>  					*data = &pdu->sdata[pdu->offset];
>  				}

Did you take care of MAX/max_t comparisons too? Looks like you missed at least
one for case 's'

Thanks,
JV


> @@ -404,9 +404,9 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
>  			break;
>  		case 's':{
>  				const char *sptr = va_arg(ap, const char *);
> -				int16_t len = 0;
> +				uint16_t len = 0;
>  				if (sptr)
> -					len = min_t(int16_t, strlen(sptr),
> +					len = min_t(uint16_t, strlen(sptr),
>  								USHRT_MAX);
> 
>  				errcode = p9pdu_writef(pdu, proto_version,


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