[sign BUG in 2.4.21]arch/sh/kernel/process.c & patch

From: Walter Harms (Walter.Harms@Informatik.Uni-Oldenburg.DE)
Date: Mon Jun 23 2003 - 10:58:11 EST


Hi list,
i have noticed a posible bug the the kernel_thread() implementation
for sh-processors. Unfortunaly i dont have an SH and cant test it.

The return value for kernel_thread() is stored as unsigned long
but the actual type is pid_t (signed).

if somebody can test this i would like to hear if this fixes the problem.
   
walter

--- arch/sh/kernel/process.c.org 2003-06-23 17:44:31.000000000 +0200
+++ arch/sh/kernel/process.c 2003-06-23 17:45:11.000000000 +0200
@@ -118,9 +118,9 @@
  * This is the mechanism for creating a new kernel thread.
  *
  */
-int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
+pid_t arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
 { /* Don't use this in BL=1(cli). Or else, CPU resets! */
- register unsigned long __sc0 __asm__ ("r0");
+ register long __sc0 __asm__ ("r0");
        register unsigned long __sc3 __asm__ ("r3") = __NR_clone;
        register unsigned long __sc4 __asm__ ("r4") = (long) flags | CLONE_VM;
        register unsigned long __sc5 __asm__ ("r5") = 0;
@@ -140,7 +140,7 @@
                : "i" (__NR_exit), "r" (__sc3), "r" (__sc4), "r" (__sc5),
                  "r" (__sc8), "r" (__sc9)
                : "memory", "t");
- return __sc0;
+ return (pid_t) __sc0;
 }
 
 /*

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



This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:41 EST