Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0
@ 2008-04-16  1:39 Roel Kluin
  2008-04-16 18:00 ` Ralf Baechle
  2008-04-16 19:39 ` Marcin Slusarz
  0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2008-04-16  1:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, lkml

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0
  2008-04-16  1:39 [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0 Roel Kluin
@ 2008-04-16 18:00 ` Ralf Baechle
  2008-04-16 19:39 ` Marcin Slusarz
  1 sibling, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2008-04-16 18:00 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linux-mips, lkml

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,

do_brk() is expected to return its first argument as the result in case
of success.  An error also wasn't getting propagated so some further
fixes were needed for irix_map_prda_page and its caller.  So I'll apply
a different fix.

Thanks!

  Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0
  2008-04-16  1:39 [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0 Roel Kluin
  2008-04-16 18:00 ` Ralf Baechle
@ 2008-04-16 19:39 ` Marcin Slusarz
  1 sibling, 0 replies; 3+ messages in thread
From: Marcin Slusarz @ 2008-04-16 19:39 UTC (permalink / raw)
  To: Roel Kluin; +Cc: ralf, linux-mips, lkml

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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-16 19:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-16  1:39 [PATCH 1/6] MIPS: irixelf: fix test unsigned var < 0 Roel Kluin
2008-04-16 18:00 ` Ralf Baechle
2008-04-16 19:39 ` Marcin Slusarz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox