amd/vpelib: Fix potential overflow calculation

[WHY]
Multiplication result may overflow int before it is converted to long
long

[HOW]
Updated the expression to avoid possible overflow

Acked-by: Chuanyu Tseng <Chuanyu.Tseng@amd.com>
Signed-off-by: Muhammad Ansari <Muhammad.Ansari@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39848>
This commit is contained in:
Ansari, Muhammad 2025-10-15 13:24:53 -04:00 committed by Marge Bot
parent dbff0fabf0
commit 58c544a9bd

View file

@ -259,7 +259,7 @@ struct fixed31_32 vpe_fixpt_cos(struct fixed31_32 arg)
do {
res = vpe_fixpt_sub(
vpe_fixpt_one, vpe_fixpt_div_int(vpe_fixpt_mul(square, res), n * (n - 1)));
vpe_fixpt_one, vpe_fixpt_div_int(vpe_fixpt_mul(square, res), (long long)n * (n - 1)));
n -= 2;
} while (n != 0);