Skip to content

Commit

Permalink
[PATCH] uml: make UML_SETJMP always safe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Oct 11, 2006
1 parent d875f9f commit b5cdb57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/um/include/longjmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit b5cdb57

Please sign in to comment.