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: <202109281918.dCsekcIa-lkp@intel.com>
Date:   Tue, 28 Sep 2021 19:48:26 +0800
From:   kernel test robot <lkp@...el.com>
To:     Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: [intel-tdx:guest 69/127] kernel/dma/direct.c:121:20: warning: shift
 count >= width of type

tree:   https://github.com/intel/tdx.git guest
head:   10b6ec254ee65ec602a7c3efde66ac0ca545b4bc
commit: b0040b6252b9f83c00f70d3b975238cb47381270 [69/127] x86/tdx: Add device filter support for x86 TDX guest platform
config: x86_64-randconfig-a002-20210928 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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/intel/tdx/commit/b0040b6252b9f83c00f70d3b975238cb47381270
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx guest
        git checkout b0040b6252b9f83c00f70d3b975238cb47381270
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 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 >>):

   In file included from kernel/dma/direct.c:7:
   In file included from include/linux/memblock.h:14:
   In file included from arch/x86/include/asm/dma.h:13:
   In file included from arch/x86/include/asm/io.h:45:
   arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> kernel/dma/direct.c:121:20: warning: shift count >= width of type [-Wshift-count-overflow]
                       phys_limit < DMA_BIT_MASK(64) &&
                                    ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   1 warning and 1 error generated.
--
   In file included from security/security.c:22:
   In file included from include/linux/ima.h:13:
   In file included from include/linux/kexec.h:19:
   In file included from arch/x86/include/asm/io.h:45:
   arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
   In file included from security/security.c:25:
>> include/linux/mman.h:158:9: warning: division by zero is undefined [-Wdivision-by-zero]
                  _calc_vm_trans(flags, MAP_SYNC,       VM_SYNC      ) |
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/mman.h:136:21: note: expanded from macro '_calc_vm_trans'
      : ((x) & (bit1)) / ((bit1) / (bit2))))
                       ^ ~~~~~~~~~~~~~~~~~
   1 warning and 1 error generated.
--
   In file included from drivers/rapidio/devices/tsi721.c:10:
   In file included from include/linux/io.h:13:
   In file included from arch/x86/include/asm/io.h:45:
   arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/rapidio/devices/tsi721.c:2839:29: warning: shift count >= width of type [-Wshift-count-overflow]
           if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
                                      ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   drivers/rapidio/devices/tsi721.c:2849:43: warning: shift count >= width of type [-Wshift-count-overflow]
                   err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
                                                           ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   2 warnings and 1 error generated.
--
   In file included from drivers/gpu/drm/vgem/vgem_drv.c:33:
   In file included from include/linux/dma-buf.h:16:
   In file included from include/linux/dma-buf-map.h:9:
   In file included from include/linux/io.h:13:
   In file included from arch/x86/include/asm/io.h:45:
   arch/x86/include/asm/tdx.h:175:12: error: incomplete definition of type 'struct device'
           return dev->authorized;
                  ~~~^
   include/linux/dynamic_debug.h:70:8: note: forward declaration of 'struct device'
   struct device;
          ^
>> drivers/gpu/drm/vgem/vgem_drv.c:460:10: warning: shift count >= width of type [-Wshift-count-overflow]
                                        DMA_BIT_MASK(64));
                                        ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   1 warning and 1 error generated.


vim +121 kernel/dma/direct.c

f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19   86  
26749b3201ab05 kernel/dma/direct.c Christoph Hellwig      2020-06-15   87  static struct page *__dma_direct_alloc_pages(struct device *dev, size_t size,
3773dfe6ea4d22 kernel/dma/direct.c Christoph Hellwig      2020-08-17   88  		gfp_t gfp)
a8463d4b0e47d1 lib/dma-noop.c      Christian Borntraeger  2016-02-02   89  {
90ae409f9eb3bc kernel/dma/direct.c Christoph Hellwig      2019-08-20   90  	int node = dev_to_node(dev);
080321d3b3139b lib/dma-direct.c    Christoph Hellwig      2017-12-22   91  	struct page *page = NULL;
a7ba70f1787f97 kernel/dma/direct.c Nicolas Saenz Julienne 2019-11-21   92  	u64 phys_limit;
a8463d4b0e47d1 lib/dma-noop.c      Christian Borntraeger  2016-02-02   93  
633d5fce78a61e kernel/dma/direct.c David Rientjes         2020-06-11   94  	WARN_ON_ONCE(!PAGE_ALIGNED(size));
633d5fce78a61e kernel/dma/direct.c David Rientjes         2020-06-11   95  
c84dc6e68a1d24 kernel/dma/direct.c David Rientjes         2020-04-14   96  	gfp |= dma_direct_optimal_gfp_mask(dev, dev->coherent_dma_mask,
a7ba70f1787f97 kernel/dma/direct.c Nicolas Saenz Julienne 2019-11-21   97  					   &phys_limit);
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19   98  	if (IS_ENABLED(CONFIG_DMA_RESTRICTED_POOL) &&
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19   99  	    is_swiotlb_for_alloc(dev)) {
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  100  		page = swiotlb_alloc(dev, size);
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  101  		if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) {
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  102  			__dma_direct_free_pages(dev, page, size);
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  103  			return NULL;
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  104  		}
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  105  		return page;
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  106  	}
f4111e39a52aa5 kernel/dma/direct.c Claire Chang           2021-06-19  107  
633d5fce78a61e kernel/dma/direct.c David Rientjes         2020-06-11  108  	page = dma_alloc_contiguous(dev, size, gfp);
90ae409f9eb3bc kernel/dma/direct.c Christoph Hellwig      2019-08-20  109  	if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) {
633d5fce78a61e kernel/dma/direct.c David Rientjes         2020-06-11  110  		dma_free_contiguous(dev, page, size);
90ae409f9eb3bc kernel/dma/direct.c Christoph Hellwig      2019-08-20  111  		page = NULL;
90ae409f9eb3bc kernel/dma/direct.c Christoph Hellwig      2019-08-20  112  	}
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  113  again:
90ae409f9eb3bc kernel/dma/direct.c Christoph Hellwig      2019-08-20  114  	if (!page)
633d5fce78a61e kernel/dma/direct.c David Rientjes         2020-06-11  115  		page = alloc_pages_node(node, gfp, get_order(size));
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  116  	if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) {
b1d2dc009dece4 kernel/dma/direct.c Nicolin Chen           2019-05-23  117  		dma_free_contiguous(dev, page, size);
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  118  		page = NULL;
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  119  
de7eab301de788 lib/dma-direct.c    Takashi Iwai           2018-04-16  120  		if (IS_ENABLED(CONFIG_ZONE_DMA32) &&
a7ba70f1787f97 kernel/dma/direct.c Nicolas Saenz Julienne 2019-11-21 @121  		    phys_limit < DMA_BIT_MASK(64) &&
de7eab301de788 lib/dma-direct.c    Takashi Iwai           2018-04-16  122  		    !(gfp & (GFP_DMA32 | GFP_DMA))) {
de7eab301de788 lib/dma-direct.c    Takashi Iwai           2018-04-16  123  			gfp |= GFP_DMA32;
de7eab301de788 lib/dma-direct.c    Takashi Iwai           2018-04-16  124  			goto again;
de7eab301de788 lib/dma-direct.c    Takashi Iwai           2018-04-16  125  		}
de7eab301de788 lib/dma-direct.c    Takashi Iwai           2018-04-16  126  
fbce251baa6e35 kernel/dma/direct.c Christoph Hellwig      2019-02-13  127  		if (IS_ENABLED(CONFIG_ZONE_DMA) && !(gfp & GFP_DMA)) {
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  128  			gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  129  			goto again;
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  130  		}
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  131  	}
95f183916d4b0b lib/dma-direct.c    Christoph Hellwig      2018-01-09  132  
b18814e767a445 kernel/dma/direct.c Christoph Hellwig      2018-11-04  133  	return page;
b18814e767a445 kernel/dma/direct.c Christoph Hellwig      2018-11-04  134  }
b18814e767a445 kernel/dma/direct.c Christoph Hellwig      2018-11-04  135  

:::::: The code at line 121 was first introduced by commit
:::::: a7ba70f1787f977f970cd116076c6fce4b9e01cc dma-mapping: treat dev->bus_dma_mask as a DMA limit

:::::: TO: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
:::::: CC: Christoph Hellwig <hch@....de>

---
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" (34605 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ