Blame view
include/linux/bug.h
1.76 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
7664c5a1d [PATCH] Generic B... |
2 3 |
#ifndef _LINUX_BUG_H #define _LINUX_BUG_H |
7664c5a1d [PATCH] Generic B... |
4 |
#include <asm/bug.h> |
a3ccc497c bug.h: make BUILD... |
5 |
#include <linux/compiler.h> |
bc6245e5e bug: split BUILD_... |
6 |
#include <linux/build_bug.h> |
7664c5a1d [PATCH] Generic B... |
7 8 9 10 11 12 |
enum bug_trap_type { BUG_TRAP_TYPE_NONE = 0, BUG_TRAP_TYPE_WARN = 1, BUG_TRAP_TYPE_BUG = 2, }; |
608e26196 generic bug: use ... |
13 |
struct pt_regs; |
35edd9103 bug: consolidate ... |
14 |
#ifdef __CHECKER__ |
ff20c2e0a mm: Some arch may... |
15 |
#define MAYBE_BUILD_BUG_ON(cond) (0) |
35edd9103 bug: consolidate ... |
16 |
#else /* __CHECKER__ */ |
ff20c2e0a mm: Some arch may... |
17 18 19 20 21 22 23 |
#define MAYBE_BUILD_BUG_ON(cond) \ do { \ if (__builtin_constant_p((cond))) \ BUILD_BUG_ON(cond); \ else \ BUG_ON(cond); \ } while (0) |
35edd9103 bug: consolidate ... |
24 |
#endif /* __CHECKER__ */ |
7664c5a1d [PATCH] Generic B... |
25 26 27 28 29 30 31 |
#ifdef CONFIG_GENERIC_BUG #include <asm-generic/bug.h> static inline int is_warning_bug(const struct bug_entry *bug) { return bug->flags & BUGFLAG_WARNING; } |
19d436268 debug: Add _ONCE(... |
32 |
struct bug_entry *find_bug(unsigned long bugaddr); |
7664c5a1d [PATCH] Generic B... |
33 |
|
608e26196 generic bug: use ... |
34 |
enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); |
7664c5a1d [PATCH] Generic B... |
35 |
|
7664c5a1d [PATCH] Generic B... |
36 37 38 39 |
/* These are defined by the architecture */ int is_valid_bugaddr(unsigned long addr); #else /* !CONFIG_GENERIC_BUG */ |
608e26196 generic bug: use ... |
40 41 |
static inline enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs) |
7664c5a1d [PATCH] Generic B... |
42 43 44 |
{ return BUG_TRAP_TYPE_BUG; } |
7664c5a1d [PATCH] Generic B... |
45 46 |
#endif /* CONFIG_GENERIC_BUG */ |
de54ebbe2 bug: Provide togg... |
47 48 49 |
/* * Since detected data corruption should stop operation on the affected |
85caa95b9 bug: switch data ... |
50 |
* structures. Return value must be checked and sanely acted on by caller. |
de54ebbe2 bug: Provide togg... |
51 |
*/ |
85caa95b9 bug: switch data ... |
52 |
static inline __must_check bool check_data_corruption(bool v) { return v; } |
de54ebbe2 bug: Provide togg... |
53 |
#define CHECK_DATA_CORRUPTION(condition, fmt, ...) \ |
85caa95b9 bug: switch data ... |
54 55 56 |
check_data_corruption(({ \ bool corruption = unlikely(condition); \ if (corruption) { \ |
de54ebbe2 bug: Provide togg... |
57 58 59 60 61 |
if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \ pr_err(fmt, ##__VA_ARGS__); \ BUG(); \ } else \ WARN(1, fmt, ##__VA_ARGS__); \ |
de54ebbe2 bug: Provide togg... |
62 |
} \ |
85caa95b9 bug: switch data ... |
63 64 |
corruption; \ })) |
de54ebbe2 bug: Provide togg... |
65 |
|
7664c5a1d [PATCH] Generic B... |
66 |
#endif /* _LINUX_BUG_H */ |