All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* re: iommu: Introduce iommu_request_dm_for_dev()
@ 2015-06-10 11:02 Dan Carpenter
  2015-06-11  7:33 ` Joerg Roedel
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-06-10 11:02 UTC (permalink / raw
  To: jroedel-l3A5Bk7waGM; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Hello Joerg Roedel,

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

The patch eeae3fba3afe: "iommu: Introduce iommu_request_dm_for_dev()" 
from May 28, 2015, leads to the following Smatch complaint:

drivers/iommu/iommu.c:1581 iommu_request_dm_for_dev()
	 error: we previously assumed 'group->default_domain' could be null (see line 1558)

drivers/iommu/iommu.c
  1557		/* Check if the default domain is already direct mapped */
  1558		ret = 0;
  1559		if (group->default_domain &&
                    ^^^^^^^^^^^^^^^^^^^^^
Check for NULL.

  1560		    group->default_domain->type == IOMMU_DOMAIN_IDENTITY)
  1561			goto out;
  1562	
  1563		/* Don't change mappings of existing devices */
  1564		ret = -EBUSY;
  1565		if (iommu_group_device_count(group) != 1)
  1566			goto out;
  1567	
  1568		/* Allocate a direct mapped domain */
  1569		ret = -ENOMEM;
  1570		dm_domain = __iommu_domain_alloc(dev->bus, IOMMU_DOMAIN_IDENTITY);
  1571		if (!dm_domain)
  1572			goto out;
  1573	
  1574		/* Attach the device to the domain */
  1575		ret = __iommu_attach_group(dm_domain, group);
  1576		if (ret) {
  1577			iommu_domain_free(dm_domain);
  1578			goto out;
  1579		}
  1580	
  1581		/* Make the direct mapped domain the default for this group */
  1582		iommu_domain_free(group->default_domain);
                                  ^^^^^^^^^^^^^^^^^^^^^
Dereferenced inside function.

  1583		group->default_domain = dm_domain;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: iommu: Introduce iommu_request_dm_for_dev()
  2015-06-10 11:02 iommu: Introduce iommu_request_dm_for_dev() Dan Carpenter
@ 2015-06-11  7:33 ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2015-06-11  7:33 UTC (permalink / raw
  To: Dan Carpenter; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Hi Dan,

On Wed, Jun 10, 2015 at 02:02:44PM +0300, Dan Carpenter wrote:
> This is a semi-automatic email about new static checker warnings.
> 
> The patch eeae3fba3afe: "iommu: Introduce iommu_request_dm_for_dev()" 
> from May 28, 2015, leads to the following Smatch complaint:
> 
> drivers/iommu/iommu.c:1581 iommu_request_dm_for_dev()
> 	 error: we previously assumed 'group->default_domain' could be null (see line 1558)

Thanks for the report, I folded a fix back into the patch introducing
this function.


	Joerg

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-11  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 11:02 iommu: Introduce iommu_request_dm_for_dev() Dan Carpenter
2015-06-11  7:33 ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.