summaryrefslogtreecommitdiff
path: root/rust/helpers/processor.c
diff options
context:
space:
mode:
authorAlex Mastro <amastro@fb.com>2025-11-25 17:11:18 -0800
committerAlex Williamson <alex@shazbot.org>2025-11-28 10:06:25 -0700
commit590d745680309f8d956c3f0a97270fe65013b272 (patch)
tree5d5d32974122de92e78da996135e6f43404edd43 /rust/helpers/processor.c
parent98693e0897f754e3f51ce6626ed5f785f625ba2b (diff)
dma-buf: fix integer overflow in fill_sg_entry() for buffers >= 8GiB
fill_sg_entry() splits large DMA buffers into multiple scatter-gather entries, each holding up to UINT_MAX bytes. When calculating the DMA address for entries beyond the second one, the expression (i * UINT_MAX) causes integer overflow due to 32-bit arithmetic. This manifests when the input arg length >= 8 GiB results in looping for i >= 2. Fix by casting i to dma_addr_t before multiplication. Fixes: 3aa31a8bb11e ("dma-buf: provide phys_vec to scatter-gather mapping routine") Signed-off-by: Alex Mastro <amastro@fb.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Leon Romanovsky <leon@kernel.org> Link: https://lore.kernel.org/r/20251125-dma-buf-overflow-v1-1-b70ea1e6c4ba@fb.com Signed-off-by: Alex Williamson <alex@shazbot.org>
Diffstat (limited to 'rust/helpers/processor.c')
0 files changed, 0 insertions, 0 deletions