msm: kgsl: Do not dereference pointer before checking against NULL
The pagetable pointer was checked against NULL after being used. Check against NULL first and then dereference it.
This commit is contained in:
parent
41b9064ec2
commit
e2ff78936f
@ -356,8 +356,8 @@ err_ptpool_remove:
|
||||
int kgsl_gpummu_pt_equal(struct kgsl_pagetable *pt,
|
||||
unsigned int pt_base)
|
||||
{
|
||||
struct kgsl_gpummu_pt *gpummu_pt = pt->priv;
|
||||
return pt && pt_base && (gpummu_pt->base.gpuaddr == pt_base);
|
||||
struct kgsl_gpummu_pt *gpummu_pt = pt ? pt->priv : NULL;
|
||||
return gpummu_pt && pt_base && (gpummu_pt->base.gpuaddr == pt_base);
|
||||
}
|
||||
|
||||
void kgsl_gpummu_destroy_pagetable(void *mmu_specific_pt)
|
||||
|
4
drivers/gpu/msm/kgsl_iommu.c
Normal file → Executable file
4
drivers/gpu/msm/kgsl_iommu.c
Normal file → Executable file
@ -34,8 +34,8 @@ struct kgsl_iommu {
|
||||
static int kgsl_iommu_pt_equal(struct kgsl_pagetable *pt,
|
||||
unsigned int pt_base)
|
||||
{
|
||||
struct iommu_domain *domain = pt->priv;
|
||||
return pt && pt_base && ((unsigned int)domain == pt_base);
|
||||
struct iommu_domain *domain = pt ? pt->priv : NULL;
|
||||
return domain && pt_base && ((unsigned int)domain == pt_base);
|
||||
}
|
||||
|
||||
static void kgsl_iommu_destroy_pagetable(void *mmu_specific_pt)
|
||||
|
Loading…
x
Reference in New Issue
Block a user