Re: linux-next: changed messages in qemu boot

From: Naveen N. Rao
Date: Tue May 24 2022 - 03:12:05 EST


Michael Ellerman wrote:
"Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxxxxxxx> writes:
Stephen Rothwell wrote:

The below diff fixes it for me:

diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c
index 46c002a8388804..7418da705d43ac 100644
--- a/arch/powerpc/kernel/trace/ftrace.c
+++ b/arch/powerpc/kernel/trace/ftrace.c
@@ -746,7 +746,7 @@ int __init ftrace_dyn_arch_init(void)
reladdr = addr - kernel_toc_addr();
- if (reladdr >= SZ_2G || reladdr < -SZ_2G) {
+ if (reladdr >= SZ_2G || reladdr < -_UL(SZ_2G)) {
pr_err("Address of %ps out of range of kernel_toc.\n",
(void *)addr);
return -1;

I did:

if (reladdr >= SZ_2G || reladdr < -(long)SZ_2G) {

That was my first attempt.

Which more closely matches what the old code did, and I think is more
obvious? ie. we don't want to negate the unsigned value, we want a
signed value, and then the negative of that.

When you put it like that... :D
In hindsight, I agree though -- _UL() isn't necessarily better.


Thanks,
Naveen