All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: jroedel-l3A5Bk7waGM@public.gmane.org
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: re: iommu: Introduce iommu_request_dm_for_dev()
Date: Wed, 10 Jun 2015 14:02:44 +0300	[thread overview]
Message-ID: <20150610110244.GA21994@mwanda> (raw)

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

             reply	other threads:[~2015-06-10 11:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 11:02 Dan Carpenter [this message]
2015-06-11  7:33 ` iommu: Introduce iommu_request_dm_for_dev() Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150610110244.GA21994@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jroedel-l3A5Bk7waGM@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.