summaryrefslogtreecommitdiff
path: root/include/linux/bug.h
diff options
context:
space:
mode:
authorSasha Levin <sashal@kernel.org>2026-03-12 07:37:08 -0400
committerSasha Levin <sashal@kernel.org>2026-03-12 07:37:08 -0400
commitacc0d99aca992e5b9a17dbd26a1275f28a959715 (patch)
tree878817fe3a3b83448f2622d3760ab9c4cf902da8 /include/linux/bug.h
parentdbe18f06a43ec3e956879604f2daf85c474a9a06 (diff)
parent93ea7e1363fb25c108debc34b9be4a4a036ee6d4 (diff)
Merge 6.18.17
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux/bug.h')
-rw-r--r--include/linux/bug.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 348acf2558f3..a9948a9f1093 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -73,15 +73,23 @@ static inline void generic_bug_clear_once(void) {}
#endif /* CONFIG_GENERIC_BUG */
+#ifdef CONFIG_PRINTK
+void mem_dump_obj(void *object);
+#else
+static inline void mem_dump_obj(void *object) {}
+#endif
+
/*
* 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, ...) \
+#define CHECK_DATA_CORRUPTION(condition, addr, fmt, ...) \
check_data_corruption(({ \
bool corruption = unlikely(condition); \
if (corruption) { \
+ if (addr) \
+ mem_dump_obj(addr); \
if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
pr_err(fmt, ##__VA_ARGS__); \
BUG(); \