]> err.no Git - linux-2.6/blobdiff - arch/sh/kernel/traps.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6] / arch / sh / kernel / traps.c
index bf70827b17ccce7dda49ccde11b70f3f76084e51..438f1ebcc45330cc0a5d320fee82a4b6840bcf1d 100644 (file)
@@ -2,6 +2,9 @@
 #include <linux/io.h>
 #include <linux/types.h>
 #include <linux/kdebug.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/uaccess.h>
 #include <asm/system.h>
 
 #ifdef CONFIG_BUG
@@ -19,7 +22,14 @@ static void handle_BUG(struct pt_regs *regs)
 
 int is_valid_bugaddr(unsigned long addr)
 {
-       return addr >= PAGE_OFFSET;
+       unsigned short opcode;
+
+       if (addr < PAGE_OFFSET)
+               return 0;
+       if (probe_kernel_address((u16 *)addr, opcode))
+               return 0;
+
+       return opcode == TRAPA_BUG_OPCODE;
 }
 #endif