public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: iommu@lists.linux-foundation.org, tursulin@ursulin.net,
	dwmw2@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/vt-d: Fix shift overflow in qi_flush_dev_iotlb
Date: Wed, 13 Dec 2017 15:13:55 +0800	[thread overview]
Message-ID: <20171213071355.GD7780@xz-mi> (raw)
In-Reply-To: <20171212224250.22173.74201.stgit@gimli.home>

On Tue, Dec 12, 2017 at 03:43:08PM -0700, Alex Williamson wrote:

[...]

> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 9a7ffd13c7f0..87888b102057 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -1345,7 +1345,9 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
>  	struct qi_desc desc;
>  
>  	if (mask) {
> -		BUG_ON(addr & ((1 << (VTD_PAGE_SHIFT + mask)) - 1));
> +		BUG_ON((mask > MAX_AGAW_PFN_WIDTH) ||
> +		       ((mask == MAX_AGAW_PFN_WIDTH) && addr) ||
> +		       (addr & ((1 << (VTD_PAGE_SHIFT + mask)) - 1)));

Could it work if we just use 1ULL instead of 1 here?  Thanks,

-- 
Peter Xu

  reply	other threads:[~2017-12-13  7:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 22:43 [PATCH] iommu/vt-d: Fix shift overflow in qi_flush_dev_iotlb Alex Williamson
2017-12-13  7:13 ` Peter Xu [this message]
2017-12-13 15:58   ` Alex Williamson
2017-12-13 16:41     ` Hook, Gary
2017-12-13 17:15       ` Alex Williamson
2017-12-13 17:31         ` Hook, Gary
2017-12-15  7:29           ` Peter Xu
2017-12-15  3:12 ` kbuild test robot

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=20171213071355.GD7780@xz-mi \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tursulin@ursulin.net \
    /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