msm: iommu: Fix NULL pointer dereference

Fix the following NULL pointer dereference issue.

Pointer '__p' returned from call to function 'smem_alloc' at line 84
may be NULL and will be dereferenced at line 85.
drivers/iommu/msm_iommu.c +85 | _msm_iommu_remote_spin_lock_init()

Change-Id: I3549e8dc6cb6b13518ced7d28186da74667c1cb6
Signed-off-by: Binoy Jayan <bjayan@codeaurora.org>
This commit is contained in:
Binoy Jayan 2016-02-19 09:46:12 +05:30 committed by Zhao Wei Liew
parent 69621fa99e
commit 32edbeece8

View file

@ -1,4 +1,5 @@
/* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. *
/* Copyright (c) 2010-2012, 2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
@ -87,8 +88,10 @@ static struct msm_iommu_remote_lock msm_iommu_remote_lock;
static void _msm_iommu_remote_spin_lock_init(void)
{
msm_iommu_remote_lock.lock = smem_alloc(SMEM_SPINLOCK_ARRAY, 32);
memset(msm_iommu_remote_lock.lock, 0,
if (msm_iommu_remote_lock.lock) {
memset(msm_iommu_remote_lock.lock, 0,
sizeof(*msm_iommu_remote_lock.lock));
}
}
void msm_iommu_remote_p0_spin_lock(void)