Mesa (staging/21.0): radv: fix overflow when computing the SQTT buffer size

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 22 17:04:58 UTC 2021


Module: Mesa
Branch: staging/21.0
Commit: acfd179fe341f1ec8ca8e0a1cda1c5cd9b6c4e24
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=acfd179fe341f1ec8ca8e0a1cda1c5cd9b6c4e24

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Thu Jan 21 13:39:27 2021 +0100

radv: fix overflow when computing the SQTT buffer size

With RADV_THREAD_TRACE_BUFFER_SIZE=1073741824, the computed size
will overflow and be 4096 instead of 4294967296.

Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8616>
(cherry picked from commit c40ea24ee009d8c9816ff6327f65be3fbd45deb7)

---

 .pick_status.json          | 2 +-
 src/amd/vulkan/radv_sqtt.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 3b228d3c263..8586882d009 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -139,7 +139,7 @@
         "description": "radv: fix overflow when computing the SQTT buffer size",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/vulkan/radv_sqtt.c b/src/amd/vulkan/radv_sqtt.c
index 263a963256f..ecd83fed728 100644
--- a/src/amd/vulkan/radv_sqtt.c
+++ b/src/amd/vulkan/radv_sqtt.c
@@ -477,7 +477,7 @@ radv_thread_trace_init_bo(struct radv_device *device)
 	/* Compute total size of the thread trace BO for 4 SEs. */
 	size = align64(sizeof(struct ac_thread_trace_info) * 4,
 		       1 << SQTT_BUFFER_ALIGN_SHIFT);
-	size += device->thread_trace.buffer_size * 4;
+	size += device->thread_trace.buffer_size * 4ll;
 
 	device->thread_trace.bo = ws->buffer_create(ws, size, 4096,
 						    RADEON_DOMAIN_VRAM,



More information about the mesa-commit mailing list