Skip to content

Commit 43ff2dc

Browse files
committed
Merge remote-tracking branch 'spi/fix/dma' into spi-linus
2 parents 0adb328 + ce99319 commit 43ff2dc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎drivers/spi/spi.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,14 @@ static int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
779779
for (i = 0; i < sgs; i++) {
780780

781781
if (vmalloced_buf || kmap_buf) {
782-
min = min_t(size_t,
783-
len, desc_len - offset_in_page(buf));
782+
/*
783+
* Next scatterlist entry size is the minimum between
784+
* the desc_len and the remaining buffer length that
785+
* fits in a page.
786+
*/
787+
min = min_t(size_t, desc_len,
788+
min_t(size_t, len,
789+
PAGE_SIZE - offset_in_page(buf)));
784790
if (vmalloced_buf)
785791
vm_page = vmalloc_to_page(buf);
786792
else

0 commit comments

Comments
 (0)