i965: map_gtt: check mapping address before adding offset
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 13 Jul 2017 15:08:34 +0000 (16:08 +0100)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 13 Jul 2017 21:50:32 +0000 (22:50 +0100)
The NULL check might fail if offset isn't 0.

CID: 971379
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index 575f04f86486762e68bd4f474169281feaac3f62..e7ebc29b59d690235b64769589c53a4a8d03a9bd 100644 (file)
@@ -2965,11 +2965,13 @@ intel_miptree_map_gtt(struct brw_context *brw,
    y /= bh;
    x /= bw;
 
-   base = intel_miptree_map_raw(brw, mt, map->mode) + mt->offset;
+   base = intel_miptree_map_raw(brw, mt, map->mode);
 
    if (base == NULL)
       map->ptr = NULL;
    else {
+      base += mt->offset;
+
       /* Note that in the case of cube maps, the caller must have passed the
        * slice number referencing the face.
       */