[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9547b988101ff5dd1e9b.1229458649@abulafia.goop.org>
Date: Tue, 16 Dec 2008 12:17:29 -0800
From: Jeremy Fitzhardinge <jeremy@...p.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: linux-kernel@...r.kernel.org,
Xen-devel <xen-devel@...ts.xensource.com>,
the arch/x86 maintainers <x86@...nel.org>,
Ian Campbell <ian.campbell@...rix.com>,
Jan Beulich <jbeulich@...ell.com>,
FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Subject: [PATCH 05 of 14] swiotlb: add comment where we handle the overflow of
a dma mask on 32 bit
From: Ian Campbell <ian.campbell@...rix.com>
Signed-off-by: Ian Campbell <ian.campbell@...rix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
---
lib/swiotlb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -301,6 +301,10 @@
start_dma_addr = virt_to_bus(io_tlb_start) & mask;
offset_slots = ALIGN(start_dma_addr, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
+
+ /*
+ * Carefully handle integer overflow which can occur when mask == ~0UL.
+ */
max_slots = mask + 1
? ALIGN(mask + 1, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT
: 1UL << (BITS_PER_LONG - IO_TLB_SHIFT);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists