]> git.baikalelectronics.ru Git - kernel.git/commit
dma-direct: fix data truncation in dma_direct_get_required_mask()
authorKishon Vijay Abraham I <kishon@ti.com>
Mon, 6 Apr 2020 05:28:36 +0000 (10:58 +0530)
committerChristoph Hellwig <hch@lst.de>
Wed, 8 Apr 2020 18:52:24 +0000 (20:52 +0200)
commit36c90e3895f5ef827c5e1dbfe84761c889dd9ce0
tree6e1d686f922eb225bac1ba2f89d8363598eee906
parent92cd601533251e3ee3eaff86e1578b3e7725c8dd
dma-direct: fix data truncation in dma_direct_get_required_mask()

The upper 32-bit physical address gets truncated inadvertently
when dma_direct_get_required_mask() invokes phys_to_dma_direct().
This results in dma_addressing_limited() return incorrect value
when used in platforms with LPAE enabled.
Fix it here by explicitly type casting 'max_pfn' to phys_addr_t
in order to prevent overflow of intermediate value while evaluating
'(max_pfn - 1) << PAGE_SHIFT'.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
kernel/dma/direct.c