Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5ddde4a authored by Ian Campbell's avatar Ian Campbell Committed by Ingo Molnar
Browse files

swiotlb: add comment where we handle the overflow of a dma mask on 32 bit



Impact: cleanup

Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
Signed-off-by: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0016fdee
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -301,6 +301,10 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir)
	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);