From: Jason Gunthorpe <jgg@ziepe.ca>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: iommu@lists.linux.dev
Subject: Re: [bug report] iommupt: Add map_pages op
Date: Fri, 21 Nov 2025 08:48:46 -0400 [thread overview]
Message-ID: <20251121124846.GD233636@ziepe.ca> (raw)
In-Reply-To: <aSAvOn2fgvmF0WYD@stanley.mountain>
On Fri, Nov 21, 2025 at 12:22:02PM +0300, Dan Carpenter wrote:
> Hello Jason Gunthorpe,
>
> Commit dcd6a011a8d5 ("iommupt: Add map_pages op") from Nov 4, 2025
> (linux-next), leads to the following Smatch static checker warning:
>
> drivers/iommu/generic_pt/fmt/../iommu_pt.h:701 increase_top()
> warn: missing unwind goto?
>
> drivers/iommu/generic_pt/fmt/../iommu_pt.h
> 665 static int increase_top(struct pt_iommu *iommu_table, struct pt_range *range,
> 666 struct pt_iommu_map_args *map)
> 667 {
> 668 struct iommu_pages_list free_list = IOMMU_PAGES_LIST_INIT(free_list);
> 669 struct pt_common *common = common_from_iommu(iommu_table);
> 670 uintptr_t top_of_table = READ_ONCE(common->top_of_table);
> 671 uintptr_t new_top_of_table = top_of_table;
> 672 struct pt_table_p *table_mem;
> 673 unsigned int new_level;
> 674 spinlock_t *domain_lock;
> 675 unsigned long flags;
> 676 int ret;
> 677
> 678 while (true) {
> 679 struct pt_range top_range =
> 680 _pt_top_range(common, new_top_of_table);
> 681 struct pt_state pts = pt_init_top(&top_range);
> 682
> 683 top_range.va = range->va;
> 684 top_range.last_va = range->last_va;
> 685
> 686 if (!pt_check_range(&top_range) && map->leaf_level <= pts.level)
> 687 break;
> 688
> 689 pts.level++;
> 690 if (pts.level > PT_MAX_TOP_LEVEL ||
> 691 pt_table_item_lg2sz(&pts) >= common->max_vasz_lg2) {
> 692 ret = -ERANGE;
> 693 goto err_free;
> 694 }
> 695
> 696 new_level = pts.level;
> 697 table_mem =
> 698 table_alloc_top(common, _pt_top_set(NULL, pts.level),
> 699 map->attrs.gfp, ALLOC_DEFER_COHERENT_FLUSH);
> 700 if (IS_ERR(table_mem))
> --> 701 return PTR_ERR(table_mem);
>
> goto err_free?
Yeah, I got this as well from your last email and already sent a patch.
> Although, why do we need to call
> iommu_pages_stop_incoherent_list() when that isn't started
True but also harmless.
Thanks,
Jason
next prev parent reply other threads:[~2025-11-21 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 9:22 [bug report] iommupt: Add map_pages op Dan Carpenter
2025-11-21 12:48 ` Jason Gunthorpe [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-11-18 7:28 Dan Carpenter
2025-11-20 17:21 ` 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=20251121124846.GD233636@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dan.carpenter@linaro.org \
--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 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.