public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fixed an off-by-one error in the AMD IOMMU driver.
@ 2009-05-14 13:00 Neil Turton
  2009-05-14 13:47 ` Roedel, Joerg
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Turton @ 2009-05-14 13:00 UTC (permalink / raw)
  To: Roedel, Joerg; +Cc: Linux Kernel, iommu

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;
 }
-- 
1.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fixed an off-by-one error in the AMD IOMMU driver.
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Roedel, Joerg @ 2009-05-14 13:47 UTC (permalink / raw)
  To: Neil Turton; +Cc: Linux Kernel, iommu

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-14 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox