Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: fix pow() crashing when given base 0

[Why&How]
pow(a,x) is implemented as exp(x*log(a)). log(0) will crash.
So return 0^x = 0, unless x=0, convention seems to be 0^0 = 1.

Cc: stable@vger.kernel.org
Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Krunoslav Kovac and committed by
Alex Deucher
5ab79431 8cfc40cd

+3
+3
drivers/gpu/drm/amd/display/include/fixed31_32.h
··· 431 431 */ 432 432 static inline struct fixed31_32 dc_fixpt_pow(struct fixed31_32 arg1, struct fixed31_32 arg2) 433 433 { 434 + if (arg1.value == 0) 435 + return arg2.value == 0 ? dc_fixpt_one : dc_fixpt_zero; 436 + 434 437 return dc_fixpt_exp( 435 438 dc_fixpt_mul( 436 439 dc_fixpt_log(arg1),