iommu/arm-smmu: Checks added for NULL pointer
Added NULL checks to avoid NULL pointer dereference. Change-Id: Id418925d708fa6bcafb37991d770d4ac7e2a69d9 Signed-off-by: Sushanth Vadapally <quic_vadapall@quicinc.com> Signed-off-by: Madhu Ananthula <quic_mananthu@quicinc.com>
This commit is contained in:
committed by
Madhu Ananthula
parent
1b00e8fe32
commit
2c7a8e4126
@@ -453,14 +453,14 @@ static int __arm_smmu_alloc_cb(unsigned long *map, int start, int end,
|
|||||||
{
|
{
|
||||||
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
|
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
|
||||||
struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev);
|
struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev);
|
||||||
struct arm_smmu_device *smmu = cfg->smmu;
|
struct arm_smmu_device *smmu;
|
||||||
int idx;
|
int idx;
|
||||||
int i;
|
int i;
|
||||||
int cb = -EINVAL;
|
int cb = -EINVAL;
|
||||||
|
|
||||||
if (!fwspec || !cfg)
|
if (!fwspec || !cfg)
|
||||||
return cb;
|
return cb;
|
||||||
|
smmu = cfg->smmu;
|
||||||
for_each_cfg_sme(cfg, fwspec, i, idx) {
|
for_each_cfg_sme(cfg, fwspec, i, idx) {
|
||||||
if (smmu->s2crs[idx].pinned)
|
if (smmu->s2crs[idx].pinned)
|
||||||
cb = smmu->s2crs[idx].cbndx;
|
cb = smmu->s2crs[idx].cbndx;
|
||||||
|
|||||||
Reference in New Issue
Block a user