Linux IOMMU Development
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: baolu.lu@linux.intel.com
Cc: iommu@lists.linux.dev
Subject: [bug report] iommu/vt-d: Add SVA domain support
Date: Tue, 15 Nov 2022 16:04:14 +0300	[thread overview]
Message-ID: <Y3OOTla3Kp3521hk@kili> (raw)

Hello Lu Baolu,

The patch eaca8889a1ef: "iommu/vt-d: Add SVA domain support" from Oct
31, 2022, leads to the following Smatch static checker warning:

drivers/gpu/drm/msm/adreno/adreno_gpu.c:213 adreno_iommu_create_address_space() warn: passing zero to 'ERR_CAST'
drivers/gpu/drm/msm/adreno/adreno_gpu.c:216 adreno_iommu_create_address_space() warn: 'geometry' isn't an ERR_PTR
drivers/iommu/intel/iommu.c:4721 intel_iommu_remove_dev_pasid() error: 'domain' dereferencing possible ERR_PTR()
drivers/iommu/io-pgfault.c:82 iopf_handler() error: 'domain' dereferencing possible ERR_PTR()

drivers/iommu/intel/iommu.c
    4713 static void intel_iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid)
    4714 {
    4715         struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
    4716         struct iommu_domain *domain;
    4717 
    4718         /* Domain type specific cleanup: */
    4719         domain = iommu_get_domain_for_dev_pasid(dev, pasid, 0);
    4720         if (domain) {

The iommu_get_domain_for_dev_pasid() function returns both error pointers
and NULL.  The comments say that it's supposed to only return NULL.  I
don't really understand what's going with these iommu functions.

--> 4721                 switch (domain->type) {
                                 ^^^^^^^^^^^^
    4722                 case IOMMU_DOMAIN_SVA:
    4723                         intel_svm_remove_dev_pasid(dev, pasid);
    4724                         break;
    4725                 default:
    4726                         /* should never reach here */
    4727                         WARN_ON(1);
    4728                         break;
    4729                 }
    4730         }
    4731 
    4732         intel_pasid_tear_down_entry(iommu, dev, pasid, false);
    4733 }

regards,
dan carpenter

             reply	other threads:[~2022-11-15 13:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 13:04 Dan Carpenter [this message]
2022-11-16  0:57 ` [bug report] iommu/vt-d: Add SVA domain support Baolu Lu

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=Y3OOTla3Kp3521hk@kili \
    --to=error27@gmail.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox