:::::: :::::: Manual check reason: "low confidence static check warning: drivers/nvme/host/pci.c:1802:41: sparse: sparse: shift too big (4096) for type int" ::::::
CC: [email protected] BCC: [email protected] CC: [email protected] TO: Keith Busch <[email protected]> tree: https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git dma-register head: 9de6909fed20955193275bbf9c75ccc85553b7d8 commit: 50a6f6bb876e20cc10372a5b8315924a493f6bf7 [3/4] big-endian and page_size fixes :::::: branch date: 6 days ago :::::: commit date: 6 days ago config: alpha-randconfig-s052-20220718 (https://download.01.org/0day-ci/archive/20220724/[email protected]/config) compiler: alpha-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git/commit/?id=50a6f6bb876e20cc10372a5b8315924a493f6bf7 git remote add kbusch https://git.kernel.org/pub/scm/linux/kernel/git/kbusch/linux.git git fetch --no-tags kbusch dma-register git checkout 50a6f6bb876e20cc10372a5b8315924a493f6bf7 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/nvme/host/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <[email protected]> sparse warnings: (new ones prefixed by >>) drivers/nvme/host/pci.c:1837:17: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long long [usertype] addr @@ got restricted __le64 [usertype] @@ drivers/nvme/host/pci.c:1837:17: sparse: expected unsigned long long [usertype] addr drivers/nvme/host/pci.c:1837:17: sparse: got restricted __le64 [usertype] drivers/nvme/host/pci.c: note: in included file: include/linux/blk-mq.h:1064:39: sparse: sparse: Using plain integer as NULL pointer include/linux/blk-mq.h:1064:39: sparse: sparse: Using plain integer as NULL pointer include/linux/blk-mq.h:1064:39: sparse: sparse: Using plain integer as NULL pointer >> drivers/nvme/host/pci.c:1802:41: sparse: sparse: shift too big (4096) for >> type int drivers/nvme/host/pci.c:1826:49: sparse: sparse: shift too big (4096) for type int drivers/nvme/host/pci.c:1849:45: sparse: sparse: shift too big (4096) for type int vim +1802 drivers/nvme/host/pci.c b60503ba432b16f drivers/block/nvme.c Matthew Wilcox 2011-01-20 1782 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1783 #ifdef CONFIG_HAS_DMA 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1784 /* 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1785 * Important: bvec must be describing a virtually contiguous buffer. 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1786 */ d129ef7beb2bf9b drivers/nvme/host/pci.c Keith Busch 2022-07-18 1787 static void *nvme_pci_dma_map(struct request_queue *q, 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1788 struct bio_vec *bvec, int nr_vecs) 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1789 { 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1790 struct nvme_ns *ns = q->queuedata; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1791 struct nvme_dev *dev = to_nvme_dev(ns->ctrl); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1792 struct nvme_dma_mapping *mapping; 50a6f6bb876e20c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1793 int i, j, k, size, ret = -ENOMEM; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1794 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1795 if (!nr_vecs) d129ef7beb2bf9b drivers/nvme/host/pci.c Keith Busch 2022-07-18 1796 return ERR_PTR(-EINVAL); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1797 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1798 mapping = kzalloc(sizeof(*mapping), GFP_KERNEL); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1799 if (!mapping) d129ef7beb2bf9b drivers/nvme/host/pci.c Keith Busch 2022-07-18 1800 return ERR_PTR(-ENOMEM); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1801 50a6f6bb876e20c drivers/nvme/host/pci.c Keith Busch 2022-07-18 @1802 nr_vecs = nr_vecs << (PAGE_SIZE - NVME_CTRL_PAGE_SIZE); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1803 size = nr_vecs * sizeof(*mapping->prps); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1804 mapping->prps = dma_alloc_coherent(dev->dev, size, 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1805 &mapping->prp_dma_addr, GFP_KERNEL); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1806 if (!mapping->prps) 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1807 goto free_mapping; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1808 50a6f6bb876e20c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1809 for (i = 0, j = 0; i < nr_vecs; i++) { 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1810 struct bio_vec *bv = bvec + i; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1811 dma_addr_t dma_addr; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1812 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1813 if (i == 0) 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1814 mapping->offset = bv->bv_offset; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1815 else if (bv->bv_offset) { 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1816 ret = -EINVAL; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1817 goto err; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1818 } 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1819 50a6f6bb876e20c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1820 dma_addr = dma_map_bvec(dev->dev, bv, 0, 0); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1821 if (dma_mapping_error(dev->dev, dma_addr)) { 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1822 ret = -EIO; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1823 goto err; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1824 } 50a6f6bb876e20c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1825 50a6f6bb876e20c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1826 for (j = 0; j < 1 << (PAGE_SIZE - NVME_CTRL_PAGE_SIZE); j++) 50a6f6bb876e20c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1827 mapping->prps[k++] = cpu_to_le64(dma_addr); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1828 } 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1829 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1830 get_device(dev->dev); d129ef7beb2bf9b drivers/nvme/host/pci.c Keith Busch 2022-07-18 1831 return mapping; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1832 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1833 err: 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1834 while (--i >= 0) { 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1835 struct bio_vec *bv = bvec + i; 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1836 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1837 dma_unmap_page(dev->dev, mapping->prps[i], bv->bv_len, 0); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1838 } 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1839 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1840 dma_free_coherent(dev->dev, size, (void *)mapping->prps, 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1841 mapping->prp_dma_addr); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1842 free_mapping: 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1843 kfree(mapping); d129ef7beb2bf9b drivers/nvme/host/pci.c Keith Busch 2022-07-18 1844 return ERR_PTR(ret); 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1845 } 8c38d1fa715ef4c drivers/nvme/host/pci.c Keith Busch 2022-07-18 1846 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
