Skip to contentSkip to conversation

iommu/ipmmu-vmsa: Replace local utlb code with fwspec ids

bug report Dan Carpenter 1 participant 1 message Aug 10, 2017

lore
Share & tools
lore
#0 lore raw

Hello Magnus Damm,

This is a semi-automatic email about new static checker warnings.

The patch 7b2d59611fef: "iommu/ipmmu-vmsa: Replace local utlb code with fwspec ids" from Jul 17, 2017, leads to the following Smatch complaint:

drivers/iommu/ipmmu-vmsa.c:555 ipmmu_attach_device()
warn: variable dereferenced before check 'priv' (see line 549)

drivers/iommu/ipmmu-vmsa.c
548 struct iommu_fwspec *fwspec = dev->iommu_fwspec;

   549		struct ipmmu_vmsa_device *mmu = priv->mmu;
                                                ^^^^^^^^^

Old dereference.

550 struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);
551 unsigned long flags;
552 unsigned int i;
553 int ret = 0;
554

   555		if (!priv || !priv->mmu) {
                     ^^^^

Patch adds new check. Should this be checking fwspec?

   556			dev_err(dev, "Cannot attach to IPMMU\n");
   557			return -ENXIO;

regards,
dan carpenter