* [chrome-os:chromeos-5.4 90/99] kernel/dma/swiotlb.c:665 swiotlb_tbl_map_single() warn: unsigned 'index' is never less than zero.
@ 2021-03-03 21:47 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-03-03 21:47 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2475 bytes --]
tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4
head: f48859423bcc5a5dc65f30eb1dd540af19cf5ebe
commit: 7220eb41bd99b5deba749d2f809ae08ca701de03 [90/99] BACKPORT: FROMLIST: swiotlb: Refactor swiotlb_tbl_{map,unmap}_single
config: i386-randconfig-m021-20210303 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
smatch warnings:
kernel/dma/swiotlb.c:665 swiotlb_tbl_map_single() warn: unsigned 'index' is never less than zero.
vim +/index +665 kernel/dma/swiotlb.c
641
642 phys_addr_t swiotlb_tbl_map_single(struct device *hwdev,
643 dma_addr_t tbl_dma_addr,
644 phys_addr_t orig_addr,
645 size_t mapping_size,
646 size_t alloc_size,
647 enum dma_data_direction dir,
648 unsigned long attrs)
649 {
650 struct swiotlb *swiotlb = get_swiotlb(hwdev);
651 phys_addr_t tlb_addr;
652 unsigned int nslots, index;
653 int i;
654
655 if (mem_encrypt_active())
656 pr_warn_once("Memory encryption is active and system is using DMA bounce buffers\n");
657
658 if (mapping_size > alloc_size) {
659 dev_warn_once(hwdev, "Invalid sizes (mapping: %zd bytes, alloc: %zd bytes)",
660 mapping_size, alloc_size);
661 return (phys_addr_t)DMA_MAPPING_ERROR;
662 }
663
664 index = swiotlb_tbl_find_free_region(hwdev, tbl_dma_addr, alloc_size, attrs);
> 665 if (index < 0)
666 return (phys_addr_t)DMA_MAPPING_ERROR;
667
668 tlb_addr = swiotlb->start + (index << IO_TLB_SHIFT);
669
670 /*
671 * Save away the mapping from the original address to the DMA address.
672 * This is needed when we sync the memory. Then we sync the buffer if
673 * needed.
674 */
675 nslots = ALIGN(alloc_size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
676 for (i = 0; i < nslots; i++)
677 swiotlb->orig_addr[index + i] = orig_addr + (i << IO_TLB_SHIFT);
678 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) &&
679 (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL))
680 swiotlb_bounce(orig_addr, tlb_addr, mapping_size, DMA_TO_DEVICE);
681
682 return tlb_addr;
683 }
684
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36040 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-03 21:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-03 21:47 [chrome-os:chromeos-5.4 90/99] kernel/dma/swiotlb.c:665 swiotlb_tbl_map_single() warn: unsigned 'index' is never less than zero kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.