summaryrefslogtreecommitdiff
path: root/lib/bug.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-06-21 13:20:19 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-06-21 13:20:19 -0700
commit2e05544060b9fef5d4d0e0172944e6956c55080f (patch)
tree34a973fce4a060e5f8148fa4418b158fc3ade1ef /lib/bug.c
parent09e3b4a76bb6047ec0b99dc668b313469d8a73d0 (diff)
parentff6f26c58421614b02694ac9d219ac61d924bc68 (diff)
Merge tag 'mm-nonmm-stable-2026-06-21-10-22' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull non-MM updates from Andrew Morton: - "taskstats: fix TGID dead-thread stat retention" (Yiyang Chen) Fix a taskstats TGID aggregation bug where fields added in the TGID query path were not preserved after thread exit, and adds a kselftest covering the regression. - "lib/tests: string_helpers: Slight improvements" (Andy Shevchenko) Improve lib/tests/string_helpers_kunit.c a little - "lib/base64: decode fixes" (Josh Law) Address minor issues in lib/base64.c - "selftests/filelock: Make output more kselftestish" (Mark Brown) Make the output from the ofdlocks test a bit easier for tooling to work with. Also ignore the generated file - "uaccess: unify inline vs outline copy_{from,to}_user() selection" (Yury Norov) Simplify the usercopy code by removing the selectability of inlining copy_{from,to}_user(). - "ocfs2: validate inline xattr header consumers" (ZhengYuan Huang) Fix a number of possible issues in the ocfs2 xattr code - "lib and lib/cmdline enhancements" (Dmitry Antipov) Provide additional robustness checking in the cmdline handling code and its in-kernel testing and selftests - "cleanup the RAID6 P/Q library" (Christoph Hellwig) Clean up the RAID6 P/Q library to match the recent updates to the RAID 5 XOR library and other CRC/crypto libraries - "ocfs2: harden inode validators against forged metadata" (Michael Bommarito) Add three structural checks to OCFS2 dinode validation so malformed on-disk fields are rejected before ocfs2_populate_inode() copies them into the in-core inode - "lib/raid: replace __get_free_pages() call with kmalloc()" (Mike Rapoport) Clean up the lib/raid code by using kmalloc() in more places * tag 'mm-nonmm-stable-2026-06-21-10-22' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (108 commits) ocfs2: fix circular locking dependency in ocfs2_dio_end_io_write ocfs2: fix NULL h_transaction deref in ocfs2_assure_trans_credits lib: interval_tree_test: validate benchmark parameters ocfs2: avoid moving extents to occupied clusters treewide: fix transposed "sign" typos and update spelling.txt ocfs2: fix UBSAN array-index-out-of-bounds in ocfs2_sum_rightmost_rec fat: reject BPB volumes whose data area starts beyond total sectors selftests/uevent: increase __UEVENT_BUFFER_SIZE to avoid ENOBUFS on busy systems lib/test_firmware: allocate the configured into_buf size fs: efs: remove unneeded debug prints checkpatch: cuppress warnings when Reported-by: is followed by Link: MAINTAINERS: add Alexander as a kcov reviewer mailmap: update Alexander Sverdlin's Email addresses fs: fat: inode: replace sprintf() with scnprintf() ocfs2: fix out-of-bounds write in ocfs2_remove_refcount_extent ocfs2: fix race between ocfs2_control_install_private() and ocfs2_control_release() ocfs2/dlm: require a ref for locking_state debugfs open ocfs2: reject FITRIM ranges shorter than a cluster ocfs2: validate fast symlink target during inode read ocfs2: add journal NULL check in ocfs2_checkpoint_inode() ...
Diffstat (limited to 'lib/bug.c')
-rw-r--r--lib/bug.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/lib/bug.c b/lib/bug.c
index d99e369bc110..292420f45811 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -1,41 +1,41 @@
// SPDX-License-Identifier: GPL-2.0
/*
- Generic support for BUG()
-
- This respects the following config options:
-
- CONFIG_BUG - emit BUG traps. Nothing happens without this.
- CONFIG_GENERIC_BUG - enable this code.
- CONFIG_GENERIC_BUG_RELATIVE_POINTERS - use 32-bit relative pointers for bug_addr and file
- CONFIG_DEBUG_BUGVERBOSE - emit full file+line information for each BUG
-
- CONFIG_BUG and CONFIG_DEBUG_BUGVERBOSE are potentially user-settable
- (though they're generally always on).
-
- CONFIG_GENERIC_BUG is set by each architecture using this code.
-
- To use this, your architecture must:
-
- 1. Set up the config options:
- - Enable CONFIG_GENERIC_BUG if CONFIG_BUG
-
- 2. Implement BUG (and optionally BUG_ON, WARN, WARN_ON)
- - Define HAVE_ARCH_BUG
- - Implement BUG() to generate a faulting instruction
- - NOTE: struct bug_entry does not have "file" or "line" entries
- when CONFIG_DEBUG_BUGVERBOSE is not enabled, so you must generate
- the values accordingly.
-
- 3. Implement the trap
- - In the illegal instruction trap handler (typically), verify
- that the fault was in kernel mode, and call report_bug()
- - report_bug() will return whether it was a false alarm, a warning,
- or an actual bug.
- - You must implement the is_valid_bugaddr(bugaddr) callback which
- returns true if the eip is a real kernel address, and it points
- to the expected BUG trap instruction.
-
- Jeremy Fitzhardinge <jeremy@goop.org> 2006
+ * Generic support for BUG()
+ *
+ * This respects the following config options:
+ *
+ * CONFIG_BUG - emit BUG traps. Nothing happens without this.
+ * CONFIG_GENERIC_BUG - enable this code.
+ * CONFIG_GENERIC_BUG_RELATIVE_POINTERS - use 32-bit relative pointers for bug_addr and file
+ * CONFIG_DEBUG_BUGVERBOSE - emit full file+line information for each BUG
+ *
+ * CONFIG_BUG and CONFIG_DEBUG_BUGVERBOSE are potentially user-settable
+ * (though they're generally always on).
+ *
+ * CONFIG_GENERIC_BUG is set by each architecture using this code.
+ *
+ * To use this, your architecture must:
+ *
+ * 1. Set up the config options:
+ * - Enable CONFIG_GENERIC_BUG if CONFIG_BUG
+ *
+ * 2. Implement BUG (and optionally BUG_ON, WARN, WARN_ON)
+ * - Define HAVE_ARCH_BUG
+ * - Implement BUG() to generate a faulting instruction
+ * - NOTE: struct bug_entry does not have "file" or "line" entries
+ * when CONFIG_DEBUG_BUGVERBOSE is not enabled, so you must generate
+ * the values accordingly.
+ *
+ * 3. Implement the trap
+ * - In the illegal instruction trap handler (typically), verify
+ * that the fault was in kernel mode, and call report_bug()
+ * - report_bug() will return whether it was a false alarm, a warning,
+ * or an actual bug.
+ * - You must implement the is_valid_bugaddr(bugaddr) callback which
+ * returns true if the eip is a real kernel address, and it points
+ * to the expected BUG trap instruction.
+ *
+ * Jeremy Fitzhardinge <jeremy@goop.org> 2006
*/
#define pr_fmt(fmt) fmt
@@ -72,7 +72,7 @@ static struct bug_entry *module_find_bug(unsigned long bugaddr)
guard(rcu)();
list_for_each_entry_rcu(mod, &module_bug_list, bug_list) {
- unsigned i;
+ unsigned int i;
bug = mod->bug_table;
for (i = 0; i < mod->num_bugs; ++i, ++bug)
@@ -192,14 +192,14 @@ void __warn_printf(const char *fmt, struct pt_regs *regs)
}
#endif
- printk("%s", fmt);
+ pr_warn("%s", fmt);
}
static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long bugaddr, struct pt_regs *regs)
{
bool warning, once, done, no_cut, has_args;
const char *file, *fmt;
- unsigned line;
+ unsigned int line;
if (!bug) {
if (!is_valid_bugaddr(bugaddr))
@@ -247,7 +247,7 @@ static enum bug_trap_type __report_bug(struct bug_entry *bug, unsigned long buga
* extra debugging message it writes before triggering the handler.
*/
if (!no_cut) {
- printk(KERN_DEFAULT CUT_HERE);
+ pr_info(CUT_HERE);
__warn_printf(fmt, has_args ? regs : NULL);
}