public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roedel, Joerg" <Joerg.Roedel@amd.com>
To: Neil Turton <nturton@solarflare.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	iommu@lists.linux-foundation.org
Subject: Re: [PATCH] Fixed an off-by-one error in the AMD IOMMU driver.
Date: Thu, 14 May 2009 15:47:17 +0200	[thread overview]
Message-ID: <20090514134717.GL9835@amd.com> (raw)
In-Reply-To: <4A0C15F3.1090601@solarflare.com>

On Thu, May 14, 2009 at 02:00:35PM +0100, Neil Turton wrote:
> The variable amd_iommu_last_bdf holds the maximum bdf of any device
> controlled by an IOMMU, so the number of device entries needed is
> amd_iommu_last_bdf+1.  The function tbl_size used amd_iommu_last_bdf
> instead.  This would be a problem if the last device were a large
> enough power of 2.
> 
> Signed-off-by: Neil Turton <nturton@solarflare.com>
> ---
>  arch/x86/kernel/amd_iommu_init.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
> index 42c33ce..61479ba 100644
> --- a/arch/x86/kernel/amd_iommu_init.c
> +++ b/arch/x86/kernel/amd_iommu_init.c
> @@ -175,7 +175,7 @@ static inline void update_last_devid(u16 devid)
>  static inline unsigned long tbl_size(int entry_size)
>  {
>  	unsigned shift = PAGE_SHIFT +
> -			 get_order(amd_iommu_last_bdf * entry_size);
> +			 get_order(((int)amd_iommu_last_bdf+1) * entry_size);
> 
>  	return 1UL << shift;
>  }

Applied, thanks Neil.

-- 
           | Advanced Micro Devices GmbH
 Operating | Karl-Hammerschmidt-Str. 34, 85609 Dornach bei München
 System    | 
 Research  | Geschäftsführer: Thomas M. McCoy, Giuliano Meroni
 Center    | Sitz: Dornach, Gemeinde Aschheim, Landkreis München
           | Registergericht München, HRB Nr. 43632


      reply	other threads:[~2009-05-14 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 13:00 [PATCH] Fixed an off-by-one error in the AMD IOMMU driver Neil Turton
2009-05-14 13:47 ` Roedel, Joerg [this message]

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=20090514134717.GL9835@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nturton@solarflare.com \
    /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