Re: [PATCH] m68k: truncate base in do_div
Andreas Schwab dixit:
>Explicitly truncate the second operand of do_div to 32 bits to guard
>against bogus code calling it with a 64bit divisor.
>
>Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Tested-by: Thorsten Glaser <tg@debian.org>
>---
> arch/m68k/include/asm/div64.h | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
>diff --git a/arch/m68k/include/asm/div64.h b/arch/m68k/include/asm/div64.h
>index 444ea8a..ef881cf 100644
>--- a/arch/m68k/include/asm/div64.h
>+++ b/arch/m68k/include/asm/div64.h
>@@ -15,16 +15,17 @@
> unsigned long long n64; \
> } __n; \
> unsigned long __rem, __upper; \
>+ unsigned long __base = (base); \
> \
> __n.n64 = (n); \
> if ((__upper = __n.n32[0])) { \
> asm ("divul.l %2,%1:%0" \
>- : "=d" (__n.n32[0]), "=d" (__upper) \
>- : "d" (base), "0" (__n.n32[0])); \
>+ : "=d" (__n.n32[0]), "=d" (__upper) \
>+ : "d" (__base), "0" (__n.n32[0])); \
> } \
> asm ("divu.l %2,%1:%0" \
>- : "=d" (__n.n32[1]), "=d" (__rem) \
>- : "d" (base), "1" (__upper), "0" (__n.n32[1])); \
>+ : "=d" (__n.n32[1]), "=d" (__rem) \
>+ : "d" (__base), "1" (__upper), "0" (__n.n32[1])); \
> (n) = __n.n64; \
> __rem; \
> })
>--
>1.8.3.4
>
>
>--
>Andreas Schwab, schwab@linux-m68k.org
>GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
>"And now for something completely different."
>
>
>--
>To UNSUBSCRIBE, email to debian-68k-REQUEST@lists.debian.org
>with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>Archive: [🔎] 871u633t27.fsf@igel.home">http://lists.debian.org/[🔎] 871u633t27.fsf@igel.home
>
>
//mirabilos
--
17:08⎜«Vutral» früher gabs keine packenden smartphones und so
17:08⎜«Vutral» heute gibts frauen die sind facebooksüchtig
17:10⎜«Vutral» aber auch traurig; früher warst du als nerd voll am arsch
17:10⎜«Vutral» heute bist du als nerd der einzige der wirklich damit klarkommt
Reply to: