mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
bug: Use normal relative pointers in 'struct bug_entry'
With CONFIG_GENERIC_BUG_RELATIVE_POINTERS, the addr/file relative pointers are calculated weirdly: based on the beginning of the bug_entry struct address, rather than their respective pointer addresses. Make the relative pointers less surprising to both humans and tools by calculating them the normal way. Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Sven Schnelle <svens@linux.ibm.com> # s390 Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Acked-by: Catalin Marinas <catalin.marinas@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> [arm64] Link: https://lkml.kernel.org/r/f0e05be797a16f4fc2401eeb88c8450dcbe61df6.1652362951.git.jpoimboe@kernel.org
This commit is contained in:
committed by
Peter Zijlstra
parent
a7fed5c043
commit
69505e3d9a
15
lib/bug.c
15
lib/bug.c
@@ -6,8 +6,7 @@
|
||||
|
||||
CONFIG_BUG - emit BUG traps. Nothing happens without this.
|
||||
CONFIG_GENERIC_BUG - enable this code.
|
||||
CONFIG_GENERIC_BUG_RELATIVE_POINTERS - use 32-bit pointers relative to
|
||||
the containing struct bug_entry for bug_addr and file.
|
||||
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
|
||||
@@ -53,10 +52,10 @@ extern struct bug_entry __start___bug_table[], __stop___bug_table[];
|
||||
|
||||
static inline unsigned long bug_addr(const struct bug_entry *bug)
|
||||
{
|
||||
#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
|
||||
return bug->bug_addr;
|
||||
#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
|
||||
return (unsigned long)&bug->bug_addr_disp + bug->bug_addr_disp;
|
||||
#else
|
||||
return (unsigned long)bug + bug->bug_addr_disp;
|
||||
return bug->bug_addr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -131,10 +130,10 @@ void bug_get_file_line(struct bug_entry *bug, const char **file,
|
||||
unsigned int *line)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_BUGVERBOSE
|
||||
#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
|
||||
*file = bug->file;
|
||||
#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
|
||||
*file = (const char *)&bug->file_disp + bug->file_disp;
|
||||
#else
|
||||
*file = (const char *)bug + bug->file_disp;
|
||||
*file = bug->file;
|
||||
#endif
|
||||
*line = bug->line;
|
||||
#else
|
||||
|
Reference in New Issue
Block a user