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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 3 Jan 2021 09:51:17 +0800
From:   kernel test robot <lkp@...el.com>
To:     Mordechay Goodstein <mordechay.goodstein@...el.com>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org,
        Luca Coelho <luciano.coelho@...el.com>
Subject: drivers/net/wireless/intel/iwlwifi/queue/tx.c:310:18: warning:
 result of comparison of constant 262140 with expression of type 'u16' (aka
 'unsigned short') is always false

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3516bd729358a2a9b090c1905bd2a3fa926e24c6
commit: 0cd1ad2d7fd41e0de4969fd1dd0aa846c99830d1 iwlwifi: move all bus-independent TX functions to common code
date:   3 months ago
config: powerpc-randconfig-r001-20210103 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 20670ba44066df0aae536822b7f7834ee3198c0d)
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
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0cd1ad2d7fd41e0de4969fd1dd0aa846c99830d1
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 0cd1ad2d7fd41e0de4969fd1dd0aa846c99830d1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

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/net/wireless/intel/iwlwifi/queue/tx.c:310:18: warning: result of comparison of constant 262140 with expression of type 'u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
           if (WARN_ON(len > PAGE_SIZE - sizeof(void *))) {
           ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bug.h:188:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
>> drivers/net/wireless/intel/iwlwifi/queue/tx.c:310:18: warning: result of comparison of constant 262140 with expression of type 'u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
           if (WARN_ON(len > PAGE_SIZE - sizeof(void *))) {
           ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bug.h:188:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ~~~~~~~~~~~~~~~~~^~~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   2 warnings generated.


vim +310 drivers/net/wireless/intel/iwlwifi/queue/tx.c

   268	
   269	/*
   270	 * Add a TB and if needed apply the FH HW bug workaround;
   271	 * meta != NULL indicates that it's a page mapping and we
   272	 * need to dma_unmap_page() and set the meta->tbs bit in
   273	 * this case.
   274	 */
   275	static int iwl_txq_gen2_set_tb_with_wa(struct iwl_trans *trans,
   276					       struct sk_buff *skb,
   277					       struct iwl_tfh_tfd *tfd,
   278					       dma_addr_t phys, void *virt,
   279					       u16 len, struct iwl_cmd_meta *meta)
   280	{
   281		dma_addr_t oldphys = phys;
   282		struct page *page;
   283		int ret;
   284	
   285		if (unlikely(dma_mapping_error(trans->dev, phys)))
   286			return -ENOMEM;
   287	
   288		if (likely(!iwl_txq_crosses_4g_boundary(phys, len))) {
   289			ret = iwl_txq_gen2_set_tb(trans, tfd, phys, len);
   290	
   291			if (ret < 0)
   292				goto unmap;
   293	
   294			if (meta)
   295				meta->tbs |= BIT(ret);
   296	
   297			ret = 0;
   298			goto trace;
   299		}
   300	
   301		/*
   302		 * Work around a hardware bug. If (as expressed in the
   303		 * condition above) the TB ends on a 32-bit boundary,
   304		 * then the next TB may be accessed with the wrong
   305		 * address.
   306		 * To work around it, copy the data elsewhere and make
   307		 * a new mapping for it so the device will not fail.
   308		 */
   309	
 > 310		if (WARN_ON(len > PAGE_SIZE - sizeof(void *))) {
   311			ret = -ENOBUFS;
   312			goto unmap;
   313		}
   314	
   315		page = get_workaround_page(trans, skb);
   316		if (!page) {
   317			ret = -ENOMEM;
   318			goto unmap;
   319		}
   320	
   321		memcpy(page_address(page), virt, len);
   322	
   323		phys = dma_map_single(trans->dev, page_address(page), len,
   324				      DMA_TO_DEVICE);
   325		if (unlikely(dma_mapping_error(trans->dev, phys)))
   326			return -ENOMEM;
   327		ret = iwl_txq_gen2_set_tb(trans, tfd, phys, len);
   328		if (ret < 0) {
   329			/* unmap the new allocation as single */
   330			oldphys = phys;
   331			meta = NULL;
   332			goto unmap;
   333		}
   334		IWL_WARN(trans,
   335			 "TB bug workaround: copied %d bytes from 0x%llx to 0x%llx\n",
   336			 len, (unsigned long long)oldphys, (unsigned long long)phys);
   337	
   338		ret = 0;
   339	unmap:
   340		if (meta)
   341			dma_unmap_page(trans->dev, oldphys, len, DMA_TO_DEVICE);
   342		else
   343			dma_unmap_single(trans->dev, oldphys, len, DMA_TO_DEVICE);
   344	trace:
   345		trace_iwlwifi_dev_tx_tb(trans->dev, skb, virt, phys, len);
   346	
   347		return ret;
   348	}
   349	

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

Powered by blists - more mailing lists