[PATCH] uml: make UML_SETJMP always safe
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Wed, 11 Oct 2006 08:21:34 +0000 (01:21 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 11 Oct 2006 18:14:20 +0000 (11:14 -0700)
If enable is moved by GCC in a register its value may not be preserved after
coming back there with longjmp().  So, mark it as volatile to prevent this;
this is suggested (it seems) in info gcc, when it talks about -Wuninitialized.
 I re-read this and it seems to say something different, but I still believe
this may be needed.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/include/longjmp.h

index e93c6d3e893b05c3ca17a9ce78ad91334f2d55cd..e860bc5848e0aaff10b382f185aed8b5a4acd81e 100644 (file)
@@ -12,7 +12,8 @@ extern void longjmp(jmp_buf, int);
 } while(0)
 
 #define UML_SETJMP(buf) ({ \
-       int n, enable;     \
+       int n;     \
+       volatile int enable;    \
        enable = get_signals(); \
        n = setjmp(*buf); \
        if(n != 0) \