Module: Mesa
Branch: main
Commit: 6ae64900e21a270ffda00de481ec0845e21389c1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ae64900e21a270ffda00de481ec0845e21389c1

Author: Samuel Pitoiset <[email protected]>
Date:   Wed Sep 13 14:49:45 2023 +0200

ac/spm: fix checking if the counter instance is valid

This should be compared against the number of global instances, and
there is also an off-by-one error.

Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25211>

---

 src/amd/common/ac_spm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/ac_spm.c b/src/amd/common/ac_spm.c
index f940a1f4a06..2d632fe7526 100644
--- a/src/amd/common/ac_spm.c
+++ b/src/amd/common/ac_spm.c
@@ -240,7 +240,7 @@ ac_spm_add_counter(const struct ac_perfcounters *pc,
    }
 
    /* Check if the number of instances is valid. */
-   if (info->b->instance > block->num_instances) {
+   if (info->b->instance > block->num_global_instances - 1) {
       fprintf(stderr, "ac/spm: Invalid instance ID.\n");
       return false;
    }

Reply via email to