Skip to content

Commit 75e7188

Browse files
committed
Merge tag 'dma-mapping-5.7-1' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fixes from Christoph Hellwig: - fix an integer truncation in dma_direct_get_required_mask (Kishon Vijay Abraham) - fix the display of dma mapping types (Grygorii Strashko) * tag 'dma-mapping-5.7-1' of git://git.infradead.org/users/hch/dma-mapping: dma-debug: fix displaying of dma allocation type dma-direct: fix data truncation in dma_direct_get_required_mask()
2 parents b753101 + 9bb50ed commit 75e7188

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

kernel/dma/debug.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,12 @@ static const char *const maperr2str[] = {
137137
[MAP_ERR_CHECKED] = "dma map error checked",
138138
};
139139

140-
static const char *type2name[5] = { "single", "page",
141-
"scather-gather", "coherent",
142-
"resource" };
140+
static const char *type2name[] = {
141+
[dma_debug_single] = "single",
142+
[dma_debug_sg] = "scather-gather",
143+
[dma_debug_coherent] = "coherent",
144+
[dma_debug_resource] = "resource",
145+
};
143146

144147
static const char *dir2name[4] = { "DMA_BIDIRECTIONAL", "DMA_TO_DEVICE",
145148
"DMA_FROM_DEVICE", "DMA_NONE" };

kernel/dma/direct.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ static inline struct page *dma_direct_to_page(struct device *dev,
3939

4040
u64 dma_direct_get_required_mask(struct device *dev)
4141
{
42-
u64 max_dma = phys_to_dma_direct(dev, (max_pfn - 1) << PAGE_SHIFT);
42+
phys_addr_t phys = (phys_addr_t)(max_pfn - 1) << PAGE_SHIFT;
43+
u64 max_dma = phys_to_dma_direct(dev, phys);
4344

4445
return (1ULL << (fls64(max_dma) - 1)) * 2 - 1;
4546
}

0 commit comments

Comments
 (0)