lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108140532.2iHbj2OX-lkp@intel.com>
Date:   Sat, 14 Aug 2021 05:01:37 +0800
From:   kernel test robot <lkp@...el.com>
To:     Sven Peter <sven@...npeter.dev>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Robin Murphy <robin.murphy@....com>
Subject: [asahilinux:dart/4kpgsize 47/51] drivers/iommu/dma-iommu.c:918:18:
 warning: incompatible integer to pointer conversion passing 'int' to
 parameter of type 'struct page *'

tree:   https://github.com/AsahiLinux/linux dart/4kpgsize
head:   7958b0de7ba6467e2f97cd8628661777d14780d8
commit: 38661a4229b4dc63dc0cae6e1401c3465538f1a1 [47/51] iommu/dma: iommu_dma_map_sg: support granule > PAGE_SIZE
config: x86_64-randconfig-c001-20210813 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 62df4df41c939205b2dc0a2a3bfb75b8c1ed74fa)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/AsahiLinux/linux/commit/38661a4229b4dc63dc0cae6e1401c3465538f1a1
        git remote add asahilinux https://github.com/AsahiLinux/linux
        git fetch --no-tags asahilinux dart/4kpgsize
        git checkout 38661a4229b4dc63dc0cae6e1401c3465538f1a1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   drivers/iommu/dma-iommu.c:918:18: error: implicit declaration of function 'phys_to_page' [-Werror,-Wimplicit-function-declaration]
                   sg_set_page(s, phys_to_page(sg_phys(s) + s_iova_off), s_length,
                                  ^
   drivers/iommu/dma-iommu.c:918:18: note: did you mean 'pmd_to_page'?
   include/linux/mm.h:2293:21: note: 'pmd_to_page' declared here
   static struct page *pmd_to_page(pmd_t *pmd)
                       ^
>> drivers/iommu/dma-iommu.c:918:18: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct page *' [-Wint-conversion]
                   sg_set_page(s, phys_to_page(sg_phys(s) + s_iova_off), s_length,
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/scatterlist.h:110:69: note: passing argument to parameter 'page' here
   static inline void sg_set_page(struct scatterlist *sg, struct page *page,
                                                                       ^
   drivers/iommu/dma-iommu.c:965:9: error: implicit declaration of function 'phys_to_page' [-Werror,-Wimplicit-function-declaration]
                                       phys_to_page(sg_phys(s) + sg_dma_address(s)),
                                       ^
   drivers/iommu/dma-iommu.c:965:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct page *' [-Wint-conversion]
                                       phys_to_page(sg_phys(s) + sg_dma_address(s)),
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/scatterlist.h:110:69: note: passing argument to parameter 'page' here
   static inline void sg_set_page(struct scatterlist *sg, struct page *page,
                                                                       ^
   drivers/iommu/dma-iommu.c:1051:18: error: implicit declaration of function 'phys_to_page' [-Werror,-Wimplicit-function-declaration]
                   sg_set_page(s, phys_to_page(s_phys - s_iova_off),
                                  ^
   drivers/iommu/dma-iommu.c:1051:18: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct page *' [-Wint-conversion]
                   sg_set_page(s, phys_to_page(s_phys - s_iova_off),
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/scatterlist.h:110:69: note: passing argument to parameter 'page' here
   static inline void sg_set_page(struct scatterlist *sg, struct page *page,
                                                                       ^
   3 warnings and 3 errors generated.


vim +918 drivers/iommu/dma-iommu.c

   896	
   897	/*
   898	 * Prepare a successfully-mapped scatterlist to give back to the caller.
   899	 *
   900	 * At this point the segments are already laid out by iommu_dma_map_sg() to
   901	 * avoid individually crossing any boundaries, so we merely need to check a
   902	 * segment's start address to avoid concatenating across one.
   903	 */
   904	static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents,
   905			dma_addr_t dma_addr)
   906	{
   907		struct scatterlist *s, *cur = sg;
   908		unsigned long seg_mask = dma_get_seg_boundary(dev);
   909		unsigned int cur_len = 0, max_len = dma_get_max_seg_size(dev);
   910		int i, count = 0;
   911	
   912		for_each_sg(sg, s, nents, i) {
   913			/* Restore this segment's original unaligned fields first */
   914			unsigned int s_iova_off = sg_dma_address(s);
   915			unsigned int s_length = sg_dma_len(s);
   916			unsigned int s_iova_len = s->length;
   917	
 > 918			sg_set_page(s, phys_to_page(sg_phys(s) + s_iova_off), s_length,
   919				    s_iova_off & ~PAGE_MASK);
   920			sg_dma_address(s) = DMA_MAPPING_ERROR;
   921			sg_dma_len(s) = 0;
   922	
   923			/*
   924			 * Now fill in the real DMA data. If...
   925			 * - there is a valid output segment to append to
   926			 * - and this segment starts on an IOVA page boundary
   927			 * - but doesn't fall at a segment boundary
   928			 * - and wouldn't make the resulting output segment too long
   929			 */
   930			if (cur_len && !s_iova_off && (dma_addr & seg_mask) &&
   931			    (max_len - cur_len >= s_length)) {
   932				/* ...then concatenate it with the previous one */
   933				cur_len += s_length;
   934			} else {
   935				/* Otherwise start the next output segment */
   936				if (i > 0)
   937					cur = sg_next(cur);
   938				cur_len = s_length;
   939				count++;
   940	
   941				sg_dma_address(cur) = dma_addr + s_iova_off;
   942			}
   943	
   944			sg_dma_len(cur) = cur_len;
   945			dma_addr += s_iova_len;
   946	
   947			if (s_length + s_iova_off < s_iova_len)
   948				cur_len = 0;
   949		}
   950		return count;
   951	}
   952	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (37985 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ