powerpc/ftrace: Fix math to calculate offset in TOC

Impact: fix dynamic ftrace with large modules in PPC64

The math to calculate the offset into the TOC that is taken from reading
the trampoline is incorrect. The bottom half of the offset is a signed
extended short. The current code was using an OR to create the offset
when it should have been using an addition.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Steven Rostedt 2009-02-07 20:22:40 +00:00 committed by Benjamin Herrenschmidt
parent eef336189b
commit f25f9074c2

View File

@ -195,8 +195,9 @@ __ftrace_make_nop(struct module *mod,
return -EINVAL; return -EINVAL;
} }
offset = (unsigned)((unsigned short)jmp[0]) << 16 | /* The bottom half is signed extended */
(unsigned)((unsigned short)jmp[1]); offset = ((unsigned)((unsigned short)jmp[0]) << 16) +
(int)((short)jmp[1]);
DEBUGP(" %x ", offset); DEBUGP(" %x ", offset);