From: kernel test robot <lkp@intel.com> To: Mordechay Goodstein <mordechay.goodstein@intel.com> Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org, Luca Coelho <luciano.coelho@intel.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 Date: Sun, 3 Jan 2021 09:51:17 +0800 [thread overview] Message-ID: <202101030910.Lehj6xQW-lkp@intel.com> (raw) [-- Attachment #1: Type: text/plain, Size: 6237 bytes --] 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@intel.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 [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 36982 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com> To: kbuild-all@lists.01.org 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 Date: Sun, 03 Jan 2021 09:51:17 +0800 [thread overview] Message-ID: <202101030910.Lehj6xQW-lkp@intel.com> (raw) [-- Attachment #1: Type: text/plain, Size: 6380 bytes --] 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@intel.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(a)lists.01.org [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 36982 bytes --]
next reply other threads:[~2021-01-03 1:53 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-03 1:51 kernel test robot [this message] 2021-01-03 1:51 ` 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 kernel test robot 2021-01-04 18:47 ` Nathan Chancellor
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=202101030910.Lehj6xQW-lkp@intel.com \ --to=lkp@intel.com \ --cc=clang-built-linux@googlegroups.com \ --cc=kbuild-all@lists.01.org \ --cc=linux-kernel@vger.kernel.org \ --cc=luciano.coelho@intel.com \ --cc=mordechay.goodstein@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.