Thread (15 messages) flat view 15 messages, 8 authors, 2017-03-08

Re: powerpc: Avoid panic during boot due to divide by zero in init_cache_info()

From: Michael Ellerman <hidden>
Date: 2017-03-08 07:25:58

On Sat, 2017-03-04 at 23:54:34 UTC, Anton Blanchard wrote:
From: Anton Blanchard <redacted>

I see a panic in early boot when building with a recent gcc toolchain.
The issue is a divide by zero, which is undefined. Older toolchains
let us get away with it:

int foo(int a) { return a / 0; }

foo:
	li 9,0
	divw 3,3,9
	extsw 3,3
	blr

But newer ones catch it:

foo:
	trap

Add a check to avoid the divide by zero.

Fixes: bd067f83b084 ("powerpc/64: Fix naming of cache block vs. cache line")
Signed-off-by: Anton Blanchard <redacted>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/6ba422c75facb1b1e0e206c464ee12

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help