mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Peter Xu <peterx@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 08:58:47 -0700	[thread overview]
Message-ID: <20171213085847.3d3245c6@t450s.home> (raw)
In-Reply-To: <20171213071355.GD7780@xz-mi>

On Wed, 13 Dec 2017 15:13:55 +0800
Peter Xu <peterx@redhat.com> wrote:

> 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,

In either case we're talking about shifting off the end of the
variable, which I understand to be undefined.  Right?  Thanks,

Alex

  reply	other threads:[~2017-12-13 15:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 22:43 Alex Williamson
2017-12-13  7:13 ` Peter Xu
2017-12-13 15:58   ` Alex Williamson [this message]
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=20171213085847.3d3245c6@t450s.home \
    --to=alex.williamson@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterx@redhat.com \
    --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

all inboxes | Powered by JetHome®