mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
tools/mm/page-types: fix ternary operator precedence in sigbus handler
The ternary operator (?:) has lower precedence than addition (+), so the expression `off + sigbus_addr ? sigbus_addr - ptr : 0` was parsed as `(off + sigbus_addr) ? (sigbus_addr - ptr) : 0` rather than the intended `off + (sigbus_addr ? sigbus_addr - ptr : 0)`. Add explicit parentheses to ensure the correct evaluation order. Link: https://lore.kernel.org/20260513022120.58033-3-ye.liu@linux.dev Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: SeongJae Park <sj@kernel.org> Cc: David Hildenbrand (Arm) <david@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
96f9fb9212
commit
e696ff06db
|
|
@ -1000,7 +1000,7 @@ static void walk_file_range(const char *name, int fd,
|
|||
fatal("madvise failed: %s", name);
|
||||
|
||||
if (sigsetjmp(sigbus_jmp, 1)) {
|
||||
end = off + sigbus_addr ? sigbus_addr - ptr : 0;
|
||||
end = off + (sigbus_addr ? sigbus_addr - ptr : 0);
|
||||
fprintf(stderr, "got sigbus at offset %lld: %s\n",
|
||||
(long long)end, name);
|
||||
goto got_sigbus;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user