* [bug report] iommu/amd: Introduce gDomID-to-hDomID Mapping and handle parent domain invalidation
[not found] <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>
@ 2026-02-06 13:38 ` Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-02-06 13:38 UTC (permalink / raw)
To: Suravee Suthikulpanit; +Cc: iommu, linux-kernel
[ Smatch checking is paused while we raise funding. #SadFace
https://lore.kernel.org/all/aTaiGSbWZ9DJaGo7@stanley.mountain/ -dan ]
Hello Suravee Suthikulpanit,
Commit 757d2b1fdf5b ("iommu/amd: Introduce gDomID-to-hDomID Mapping
and handle parent domain invalidation") from Jan 15, 2026
(linux-next), leads to the following Smatch static checker warning:
drivers/iommu/amd/nested.c:161 amd_iommu_alloc_domain_nested()
warn: 'gdom_info->hdom_id' unsigned <= 0
drivers/iommu/amd/nested.c
148 /* Check if gDomID exist */
149 if (refcount_inc_not_zero(&gdom_info->users)) {
150 ndom->gdom_info = gdom_info;
151 xa_unlock(&aviommu->gdomid_array);
152
153 pr_debug("%s: Found gdom_id=%#x, hdom_id=%#x\n",
154 __func__, ndom->gdom_id, gdom_info->hdom_id);
155
156 return &ndom->domain;
157 }
158
159 /* The gDomID does not exist. We allocate new hdom_id */
160 gdom_info->hdom_id = amd_iommu_pdom_id_alloc();
--> 161 if (gdom_info->hdom_id <= 0) {
gdom_info->hdom_id is unsigned. amd_iommu_pdom_id_alloc() can't return
zero. It either returns negatives or 1-65535.
162 __xa_cmpxchg(&aviommu->gdomid_array,
163 ndom->gdom_id, gdom_info, NULL, GFP_ATOMIC);
164 xa_unlock(&aviommu->gdomid_array);
165 ret = -ENOSPC;
166 goto out_err_gdom_info;
167 }
168
169 ndom->gdom_info = gdom_info;
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-06 13:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <caa37f28-a2e8-4e0a-a9ce-a365ce805e4b@stanley.mountain>
2026-02-06 13:38 ` [bug report] iommu/amd: Introduce gDomID-to-hDomID Mapping and handle parent domain invalidation Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox