From: Dan Carpenter <error27@gmail.com>
To: jgg@ziepe.ca
Cc: iommu@lists.linux.dev
Subject: [bug report] iommufd: Add a selftest
Date: Tue, 15 Nov 2022 15:49:44 +0300 [thread overview]
Message-ID: <Y3OK6DeM6X4q5JWO@kili> (raw)
Hello Jason Gunthorpe,
The patch 147393321d65: "iommufd: Add a selftest" from Nov 19, 2021,
leads to the following Smatch static checker warning:
drivers/iommu/iommufd/selftest.c:160 mock_domain_map_pages()
warn: use 'gfp' here instead of GFP_XXX?
drivers/iommu/iommufd/selftest.c
133 static int mock_domain_map_pages(struct iommu_domain *domain,
134 unsigned long iova, phys_addr_t paddr,
135 size_t pgsize, size_t pgcount, int prot,
136 gfp_t gfp, size_t *mapped)
137 {
138 struct mock_iommu_domain *mock =
139 container_of(domain, struct mock_iommu_domain, domain);
140 unsigned long flags = MOCK_PFN_START_IOVA;
141 unsigned long start_iova = iova;
142
143 /*
144 * xarray does not reliably work with fault injection because it does a
145 * retry allocation, so put our own failure point.
146 */
147 if (iommufd_should_fail())
148 return -ENOENT;
149
150 WARN_ON(iova % MOCK_IO_PAGE_SIZE);
151 WARN_ON(pgsize % MOCK_IO_PAGE_SIZE);
152 for (; pgcount; pgcount--) {
153 size_t cur;
154
155 for (cur = 0; cur != pgsize; cur += MOCK_IO_PAGE_SIZE) {
156 void *old;
157
158 if (pgcount == 1 && cur + MOCK_IO_PAGE_SIZE == pgsize)
159 flags = MOCK_PFN_LAST_IOVA;
160 old = xa_store(&mock->pfns, iova / MOCK_IO_PAGE_SIZE,
161 xa_mk_value((paddr / MOCK_IO_PAGE_SIZE) |
162 flags),
163 GFP_KERNEL);
^^^^^^^^^^
"gfp" isn't used anywhere so maybe it was intended here?
164 if (xa_is_err(old)) {
165 for (; start_iova != iova;
166 start_iova += MOCK_IO_PAGE_SIZE)
167 xa_erase(&mock->pfns,
168 start_iova /
169 MOCK_IO_PAGE_SIZE);
170 return xa_err(old);
171 }
172 WARN_ON(old);
173 iova += MOCK_IO_PAGE_SIZE;
174 paddr += MOCK_IO_PAGE_SIZE;
regards,
dan carpenter
next reply other threads:[~2022-11-15 12:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 12:49 Dan Carpenter [this message]
2022-11-15 13:25 ` [bug report] iommufd: Add a selftest Jason Gunthorpe
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=Y3OK6DeM6X4q5JWO@kili \
--to=error27@gmail.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
/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