Mesa (master): i965/program_cache: Cast the key to char * before adding key_size

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 10 19:55:06 UTC 2019


Module: Mesa
Branch: master
Commit: 3a4667e502c458b6ac0ae3d4641612a9186a1924
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a4667e502c458b6ac0ae3d4641612a9186a1924

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Sat Feb 23 11:53:43 2019 -0600

i965/program_cache: Cast the key to char * before adding key_size

We're about to change the type of key to be brw_base_prog_key and that
will mean blindly adding the key size without a cast will lead to the
wrong calculation.  It's safer to cast to char * first anyway.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_program_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c
index 600b0611c8b..47b71a2e16f 100644
--- a/src/mesa/drivers/dri/i965/brw_program_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_program_cache.c
@@ -429,7 +429,7 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
              c->cache_id == BRW_CACHE_GS_PROG ||
              c->cache_id == BRW_CACHE_FS_PROG ||
              c->cache_id == BRW_CACHE_CS_PROG) {
-            const void *item_prog_data = c->key + c->key_size;
+            const void *item_prog_data = ((char *)c->key) + c->key_size;
             brw_stage_prog_data_free(item_prog_data);
          }
          free((void *)c->key);




More information about the mesa-commit mailing list