linux-mips
[Top] [All Lists]

Re: [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0

To: Roel Kluin <12o3l@tiscali.nl>
Subject: Re: [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Date: Wed, 16 Apr 2008 21:39:44 +0200
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org, lkml <linux-kernel@vger.kernel.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; bh=LeU4640JuXOAT3alpUq4Dlf3VUA2GyhCHU9wHSqaM2g=; b=KnPUDvoxbuP6LdL1l7S3xI2lmAaPzXCIfaqjFMmsP5Kza9IXjbTmgS85JF64tC3BhsNz3gZDqekD9qB3IIE3R1oWTtmoUppfzamz9hTZvQCNrX6cSVGdMD9feor6se/WPdPFMi32d9QLiJf2plgTKf6f63SsSRY3m43Hgn+rdzA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=WLp8gMTRHhY2RUld/XToVJfOZt84n7OFrWfp85w4iTSrM2T4hZEFt6hjg0KTMK9z7gxrHj3Xf58VqYsPoJUZDabuUg8gq25kcJggayby7ZT341cKk/CDt3UH6D0GzB3rhFSHPSMDp9fTgVqD99Y8OiCz9D8tnkVUfmltjGLB5gk=
In-reply-to: <480558CA.7090800@tiscali.nl>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <480558CA.7090800@tiscali.nl>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.16 (2007-06-09)
On Wed, Apr 16, 2008 at 03:39:22AM +0200, Roel Kluin wrote:
> v is unsigned, cast to signed to evaluate the do_brk() return value,
>     
> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> ---
> diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
> index 290d8e3..fad2a2a 100644
> --- a/arch/mips/kernel/irixelf.c
> +++ b/arch/mips/kernel/irixelf.c
> @@ -583,15 +583,15 @@ static void irix_map_prda_page(void)
>       unsigned long v;
>       struct prda *pp;
>  
>       down_write(&current->mm->mmap_sem);
>       v =  do_brk(PRDA_ADDRESS, PAGE_SIZE);
>       up_write(&current->mm->mmap_sem);
>  
> -     if (v < 0)
> +     if ((long) v < 0)
maybe cast it earlier (to struct prda *) and check error with IS_ERR?

>               return;
>  
>       pp = (struct prda *) v;
>       pp->prda_sys.t_pid  = task_pid_vnr(current);
>       pp->prda_sys.t_prid = read_c0_prid();
>       pp->prda_sys.t_rpid = task_pid_vnr(current);
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

<Prev in Thread] Current Thread [Next in Thread>