Changes in 4.9.297 Bluetooth: btusb: Apply QCA Rome patches for some ATH3012 models tracing: Fix check for trace_percpu_buffer validity in get_trace_buf() tracing: Tag trace_percpu_buffer as a percpu pointer virtio_pci: Support surprise removal of virtio pci device ieee802154: atusb: fix uninit value in atusb_set_extended_addr mac80211: initialize variable have_higher_than_11mbit i40e: Fix incorrect netdev's real number of RX/TX queues sch_qfq: prevent shift-out-of-bounds in qfq_init_qdisc xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate rndis_host: support Hytera digital radios bug: split BUILD_BUG stuff out into <linux/build_bug.h> arm64: Remove a redundancy in sysreg.h arm64: reduce el2_setup branching arm64: move !VHE work to end of el2_setup arm64: sysreg: Move to use definitions for all the SCTLR bits phonet: refcount leak in pep_sock_accep scsi: libiscsi: Fix UAF in iscsi_conn_get_param()/iscsi_conn_teardown() ip6_vti: initialize __ip6_tnl_parm struct in vti6_siocdevprivate net: udp: fix alignment problem in udp4_seq_show() mISDN: change function names to avoid conflicts power: reset: ltc2952: Fix use of floating point literals Linux 4.9.297 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I1b6c457971ca5e3b4d2354852a7eeeaccc965a46
79 lines
1.8 KiB
C
79 lines
1.8 KiB
C
#ifndef _LINUX_BUG_H
|
|
#define _LINUX_BUG_H
|
|
|
|
#include <asm/bug.h>
|
|
#include <linux/compiler.h>
|
|
#include <linux/build_bug.h>
|
|
|
|
enum bug_trap_type {
|
|
BUG_TRAP_TYPE_NONE = 0,
|
|
BUG_TRAP_TYPE_WARN = 1,
|
|
BUG_TRAP_TYPE_BUG = 2,
|
|
};
|
|
|
|
struct pt_regs;
|
|
|
|
#ifdef __CHECKER__
|
|
#define MAYBE_BUILD_BUG_ON(cond) (0)
|
|
#else /* __CHECKER__ */
|
|
|
|
#define MAYBE_BUILD_BUG_ON(cond) \
|
|
do { \
|
|
if (__builtin_constant_p((cond))) \
|
|
BUILD_BUG_ON(cond); \
|
|
else \
|
|
BUG_ON(cond); \
|
|
} while (0)
|
|
|
|
#endif /* __CHECKER__ */
|
|
|
|
#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;
|
|
}
|
|
|
|
const struct bug_entry *find_bug(unsigned long bugaddr);
|
|
|
|
enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
|
|
|
|
/* These are defined by the architecture */
|
|
int is_valid_bugaddr(unsigned long addr);
|
|
|
|
#else /* !CONFIG_GENERIC_BUG */
|
|
|
|
static inline void *find_bug(unsigned long bugaddr)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline enum bug_trap_type report_bug(unsigned long bug_addr,
|
|
struct pt_regs *regs)
|
|
{
|
|
return BUG_TRAP_TYPE_BUG;
|
|
}
|
|
|
|
#endif /* CONFIG_GENERIC_BUG */
|
|
|
|
/*
|
|
* Since detected data corruption should stop operation on the affected
|
|
* structures. Return value must be checked and sanely acted on by caller.
|
|
*/
|
|
static inline __must_check bool check_data_corruption(bool v) { return v; }
|
|
#define CHECK_DATA_CORRUPTION(condition, fmt, ...) \
|
|
check_data_corruption(({ \
|
|
bool corruption = unlikely(condition); \
|
|
if (corruption) { \
|
|
if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
|
|
pr_err(fmt, ##__VA_ARGS__); \
|
|
BUG(); \
|
|
} else \
|
|
WARN(1, fmt, ##__VA_ARGS__); \
|
|
} \
|
|
corruption; \
|
|
}))
|
|
|
|
#endif /* _LINUX_BUG_H */
|