Conflicts: arch/arm/Makefile arch/arm/include/asm/unistd.h arch/arm/kernel/calls.S arch/arm64/include/asm/assembler.h arch/arm64/include/asm/cputype.h arch/arm64/kernel/bpi.S arch/arm64/kernel/cpu_errata.c arch/arm64/kernel/setup.c arch/arm64/kernel/vdso.c arch/arm64/mm/proc.S arch/mips/include/uapi/asm/Kbuild arch/powerpc/include/uapi/asm/Kbuild drivers/char/Kconfig drivers/char/random.c drivers/clk/qcom/clk-rcg2.c drivers/gpu/drm/drm_edid.c drivers/irqchip/irq-gic.c drivers/md/dm-table.c drivers/media/dvb-core/dmxdev.c drivers/mmc/core/core.c drivers/mmc/core/host.c drivers/mmc/core/mmc.c drivers/mmc/host/sdhci.c drivers/net/usb/lan78xx.c drivers/scsi/ufs/ufs_quirks.h drivers/scsi/ufs/ufshcd.c drivers/staging/android/ion/ion-ioctl.c drivers/staging/android/ion/ion.c drivers/staging/android/ion/ion_priv.h drivers/staging/android/ion/ion_system_heap.c drivers/tty/tty_io.c drivers/usb/core/hub.c drivers/usb/core/usb.h drivers/usb/dwc3/core.c drivers/usb/dwc3/gadget.c drivers/usb/gadget/composite.c drivers/usb/gadget/configfs.c drivers/usb/gadget/function/f_accessory.c drivers/usb/gadget/function/rndis.c drivers/usb/gadget/function/rndis.h fs/eventpoll.c fs/ext4/namei.c fs/fat/fatent.c fs/gfs2/acl.c include/linux/random.h include/uapi/drm/Kbuild include/uapi/linux/Kbuild include/uapi/linux/cifs/Kbuild include/uapi/linux/genwqe/Kbuild kernel/cpu.c kernel/exit.c kernel/sched/cpufreq_schedutil.c lib/Makefile lib/string.c mm/memory.c mm/page-writeback.c mm/page_alloc.c net/ipv4/udp.c net/ipv6/datagram.c net/ipv6/ip6_output.c net/netfilter/nf_conntrack_irc.c net/netfilter/xt_quota2.c net/netlink/genetlink.c security/selinux/avc.c security/selinux/include/objsec.h sound/core/compress_offload.c Change-Id: I41982a5a8e22a21b72ec5dfa61a3680be66213f4
84 lines
1.9 KiB
C
84 lines
1.9 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 */
|
|
|
|
#ifdef CONFIG_PANIC_ON_DATA_CORRUPTION
|
|
#define PANIC_CORRUPTION 1
|
|
#else
|
|
#define PANIC_CORRUPTION 0
|
|
#endif /* CONFIG_PANIC_ON_DATA_CORRUPTION */
|
|
/*
|
|
* 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 */
|