From 35cbab39abd7eda07453dbfd0c3f924410eadf31 Mon Sep 17 00:00:00 2001 From: Corcodel Marian Date: Tue, 15 Nov 2016 10:33:03 +0200 Subject: [PATCH 1/8] Disable loop operation on BUG, BUG_ON, arch/x86/include/asm/bug.h,include/asm-generic/bug.h This make spann on proc. --- arch/x86/include/asm/bug.h | 8 ++------ include/asm-generic/bug.h | 11 +++++------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h index ba38ebb..5b636a5 100644 --- a/arch/x86/include/asm/bug.h +++ b/arch/x86/include/asm/bug.h @@ -12,7 +12,6 @@ #endif #define BUG() \ -do { \ asm volatile("1:\tud2\n" \ ".pushsection __bug_table,\"a\"\n" \ __BUG_C0 \ @@ -21,15 +20,12 @@ do { \ ".popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (sizeof(struct bug_entry))); \ - unreachable(); \ -} while (0) + unreachable(); #else #define BUG() \ -do { \ asm volatile("ud2"); \ - unreachable(); \ -} while (0) + unreachable(); #endif #include diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 6f96247..c4d6c3b 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -45,14 +45,13 @@ struct bug_entry { * users don't need to reboot ASAP and can mostly shut down cleanly. */ #ifndef HAVE_ARCH_BUG -#define BUG() do { \ +#define BUG() \ printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ - panic("BUG!"); \ -} while (0) + panic("BUG!"); #endif #ifndef HAVE_ARCH_BUG_ON -#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) +#define BUG_ON(condition) if (unlikely(condition)) BUG() #endif /* @@ -147,11 +146,11 @@ void __warn(const char *file, int line, void *caller, unsigned taint, #else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG() do {} while (1) +#define BUG() #endif #ifndef HAVE_ARCH_BUG_ON -#define BUG_ON(condition) do { if (condition) BUG(); } while (0) +#define BUG_ON(condition) if (condition) BUG() #endif #ifndef HAVE_ARCH_WARN_ON -- 2.7.4