From 60a637c3376c8e7acac5bd1582b65b6b4e876817 Mon Sep 17 00:00:00 2001 From: Hareesh Gundu Date: Wed, 29 Dec 2021 12:20:00 +0530 Subject: [PATCH] msm: kgsl: Skip some gmu global memory dump to snapshot Gmu global such as ipc core memdesc is not mapped to host. Skip these kind of gmu global memdesc dumping to snapshot to avoid null pointer dereference. Change-Id: Idba9168e854430253624629ed45826015773148f Signed-off-by: Hareesh Gundu --- adreno_a6xx_gmu_snapshot.c | 2 +- adreno_gen7_gmu_snapshot.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/adreno_a6xx_gmu_snapshot.c b/adreno_a6xx_gmu_snapshot.c index e11f70e0b2..bb61241433 100644 --- a/adreno_a6xx_gmu_snapshot.c +++ b/adreno_a6xx_gmu_snapshot.c @@ -156,7 +156,7 @@ static size_t a6xx_snapshot_gmu_mem(struct kgsl_device *device, (buf + sizeof(*mem_hdr)); struct gmu_mem_type_desc *desc = priv; - if (priv == NULL) + if (priv == NULL || desc->memdesc->hostptr == NULL) return 0; if (remain < desc->memdesc->size + sizeof(*mem_hdr)) { diff --git a/adreno_gen7_gmu_snapshot.c b/adreno_gen7_gmu_snapshot.c index 39c3c184a9..a0cddf41d3 100644 --- a/adreno_gen7_gmu_snapshot.c +++ b/adreno_gen7_gmu_snapshot.c @@ -87,6 +87,9 @@ static size_t gen7_snapshot_gmu_mem(struct kgsl_device *device, (buf + sizeof(*mem_hdr)); struct gmu_mem_type_desc *desc = priv; + if (priv == NULL || desc->memdesc->hostptr == NULL) + return 0; + if (remain < desc->memdesc->size + sizeof(*mem_hdr)) { dev_err(device->dev, "snapshot: Not enough memory for the gmu section %d\n",