summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-08-26 12:47:36 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-08-26 12:47:36 +0000
commit0f544ff9c9b61085a505edf8e8dbd05cdfad08b4 (patch)
treeb740f82b35c627498683d00e99a551a067f7581b /sys
parented5b51aca5cceb406f428abc2ab8b92a65c97845 (diff)
drm/amd/display: fix pow() crashing when given base 0
From Krunoslav Kovac b9d077f3781412f304968cf806f636ee91b4470e in linux 5.7.y/5.7.18 d2e59d0ff4c44d1f6f8ed884a5bea7d1bb7fd98c in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/amd/display/include/fixed31_32.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/display/include/fixed31_32.h b/sys/dev/pci/drm/amd/display/include/fixed31_32.h
index 89ef9f6860e..16df2a485dd 100644
--- a/sys/dev/pci/drm/amd/display/include/fixed31_32.h
+++ b/sys/dev/pci/drm/amd/display/include/fixed31_32.h
@@ -431,6 +431,9 @@ struct fixed31_32 dc_fixpt_log(struct fixed31_32 arg);
*/
static inline struct fixed31_32 dc_fixpt_pow(struct fixed31_32 arg1, struct fixed31_32 arg2)
{
+ if (arg1.value == 0)
+ return arg2.value == 0 ? dc_fixpt_one : dc_fixpt_zero;
+
return dc_fixpt_exp(
dc_fixpt_mul(
dc_fixpt_log(arg1),