aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-03-10 04:15:09 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2022-03-10 04:15:09 -0800
commit1db333d9a51f3459fba1bcaa564d95befe79f0b3 (patch)
tree80e70bae6cd0918edc31e3e80c959c67e33ff0b8
parentb1a384d2cbccb1eb3f84765020d25e2c1929706e (diff)
parent1a4e53d2fc4f68aa654ad96d13ad042e1a8e8a7d (diff)
downloadlinux-1db333d9a51f3459fba1bcaa564d95befe79f0b3.tar.gz
Merge tag 'spi-fix-v5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fix from Mark Brown: "One fix for type conversion issues when working out maximum scatter/gather segment sizes. It caused problems for some systems where the limits overflow due to the type conversion" * tag 'spi-fix-v5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: Fix invalid sgs value
-rw-r--r--drivers/spi/spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 4599b121d74423..d96082dc3340db 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1019,10 +1019,10 @@ int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
int i, ret;
if (vmalloced_buf || kmap_buf) {
- desc_len = min_t(int, max_seg_size, PAGE_SIZE);
+ desc_len = min_t(unsigned int, max_seg_size, PAGE_SIZE);
sgs = DIV_ROUND_UP(len + offset_in_page(buf), desc_len);
} else if (virt_addr_valid(buf)) {
- desc_len = min_t(int, max_seg_size, ctlr->max_dma_len);
+ desc_len = min_t(unsigned int, max_seg_size, ctlr->max_dma_len);
sgs = DIV_ROUND_UP(len, desc_len);
} else {
return -EINVAL;