panfrost: Make sure pack_work_groups_compute() is passed valid dimensions

Make sure size_{x,y,z} and num_{x,y,s} are positive, otherwise we end
up with an integer underflow.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10332>
This commit is contained in:
Boris Brezillon 2021-04-19 17:54:11 +02:00 committed by Marge Bot
parent 54a4e75223
commit 7d14a0cb99

View file

@ -57,6 +57,12 @@ panfrost_pack_work_groups_compute(
unsigned shifts[7] = { 0 };
/* Make sure size_{x,y,z} and num_{x,y,z} are positive, otherwise we
* end up with an integer underflow.
*/
assert(size_x && size_y && size_z);
assert(num_x && num_y && num_z);
unsigned values[6] = {
MALI_POSITIVE(size_x),
MALI_POSITIVE(size_y),