From 12e22d5bc1afe302206897ad7ea51dcd22f0e857 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 6 Nov 2025 11:49:15 -0800 Subject: [PATCH] anv: prevent potential, but unlikely, overflow The code in question multiplies `uint32_t`s together and assigns them to a `uint64_t`. It seems rather unlikely at there would be an overflow, but we might as well do the cast. CID: 1649587 Reviewed-by: Paulo Zanoni Part-of: --- src/intel/vulkan/anv_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_video.c b/src/intel/vulkan/anv_video.c index 4e054ba6479..2a265f3252b 100644 --- a/src/intel/vulkan/anv_video.c +++ b/src/intel/vulkan/anv_video.c @@ -588,7 +588,7 @@ get_vp9_video_mem_size(struct anv_video_session *vid, uint32_t mem_idx) size = 32; break; case ANV_VID_MEM_VP9_SEGMENT_ID: - size = width_in_ctb * height_in_ctb; + size = (uint64_t)width_in_ctb * height_in_ctb; break; case ANV_VID_MEM_VP9_HVD_LINE_ROW_STORE: case ANV_VID_MEM_VP9_HVD_TILE_ROW_STORE: @@ -596,7 +596,7 @@ get_vp9_video_mem_size(struct anv_video_session *vid, uint32_t mem_idx) break; case ANV_VID_MEM_VP9_MV_1: case ANV_VID_MEM_VP9_MV_2: - size = (width_in_ctb * height_in_ctb * 9); + size = ((uint64_t)width_in_ctb * height_in_ctb * 9); break; default: UNREACHABLE("unknown memory");