diff options
author | Dexuan Cui <decui@microsoft.com> | 2022-06-22 12:14:24 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-29 09:03:31 +0200 |
commit | cced9ce619ef483616b9e5ef4da6287ba2292a29 (patch) | |
tree | 8c7c1bd97a12a29a7b25d048650371f3272bae2f /kernel | |
parent | a8bbb4c26460cf5b6cda080c58c49faf10e9bcda (diff) | |
download | linux-stable-cced9ce619ef483616b9e5ef4da6287ba2292a29.tar.gz linux-stable-cced9ce619ef483616b9e5ef4da6287ba2292a29.tar.bz2 linux-stable-cced9ce619ef483616b9e5ef4da6287ba2292a29.zip |
dma-direct: use the correct size for dma_set_encrypted()
commit 3be4562584bba603f33863a00c1c32eecf772ee6 upstream.
The third parameter of dma_set_encrypted() is a size in bytes rather than
the number of pages.
Fixes: 4d0564785bb0 ("dma-direct: factor out dma_set_{de,en}crypted helpers")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/dma/direct.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 854d6df969de..ed5dd9e02324 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -323,7 +323,7 @@ void dma_direct_free(struct device *dev, size_t size, } else { if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_CLEAR_UNCACHED)) arch_dma_clear_uncached(cpu_addr, size); - if (dma_set_encrypted(dev, cpu_addr, 1 << page_order)) + if (dma_set_encrypted(dev, cpu_addr, size)) return; } @@ -360,7 +360,6 @@ void dma_direct_free_pages(struct device *dev, size_t size, struct page *page, dma_addr_t dma_addr, enum dma_data_direction dir) { - unsigned int page_order = get_order(size); void *vaddr = page_address(page); /* If cpu_addr is not from an atomic pool, dma_free_from_pool() fails */ @@ -368,7 +367,7 @@ void dma_direct_free_pages(struct device *dev, size_t size, dma_free_from_pool(dev, vaddr, size)) return; - if (dma_set_encrypted(dev, vaddr, 1 << page_order)) + if (dma_set_encrypted(dev, vaddr, size)) return; __dma_direct_free_pages(dev, page, size); } |