i965/program_cache: Cast the key to char * before adding key_size
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 23 Feb 2019 17:53:43 +0000 (11:53 -0600)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 10 Jul 2019 19:35:55 +0000 (19:35 +0000)
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@whitecape.org>
src/mesa/drivers/dri/i965/brw_program_cache.c

index 600b0611c8b89095e39395710b859fe397812910..47b71a2e16fcd91a6c77fa4b2a6a9222dd0ddce4 100644 (file)
@@ -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);