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: <202006121613.IrnjNJrA%lkp@intel.com>
Date:   Fri, 12 Jun 2020 16:50:17 +0800
From:   kernel test robot <lkp@...el.com>
To:     Bernard Metzler <bmt@...ich.ibm.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Doug Ledford <dledford@...hat.com>
Subject: drivers/infiniband/sw/siw/siw_qp_rx.c:141:3: note: in expansion of
 macro 'if'

Hi Bernard,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b791d1bdf9212d944d749a5c7ff6febdba241771
commit: 2c8ccb37b08fe364f02a9914daca474d43151453 RDMA/siw: Change CQ flags from 64->32 bits
date:   10 months ago
config: i386-randconfig-r011-20200612 (attached as .config)
compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
reproduce (this is a W=1 build):
        git checkout 2c8ccb37b08fe364f02a9914daca474d43151453
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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 >>, old ones prefixed by <<):

In file included from include/linux/kernel.h:15:0,
from include/linux/list.h:9,
from include/linux/random.h:10,
from include/linux/net.h:18,
from drivers/infiniband/sw/siw/siw_qp_rx.c:8:
drivers/infiniband/sw/siw/siw_qp_rx.c: In function 'siw_rx_umem':
drivers/infiniband/sw/siw/siw_qp_rx.c:43:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
(void *)dest_addr, (void *)umem->fp_addr);
^
include/linux/printk.h:306:37: note: in definition of macro 'pr_warning'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
drivers/infiniband/sw/siw/siw_qp_rx.c:41:4: note: in expansion of macro 'pr_warn'
pr_warn("siw: %s: [QP %u]: bogus addr: %p, %pn",
^
drivers/infiniband/sw/siw/siw_qp_rx.c:43:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
(void *)dest_addr, (void *)umem->fp_addr);
^
include/linux/printk.h:306:37: note: in definition of macro 'pr_warning'
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
drivers/infiniband/sw/siw/siw_qp_rx.c:41:4: note: in expansion of macro 'pr_warn'
pr_warn("siw: %s: [QP %u]: bogus addr: %p, %pn",
^
In file included from include/linux/export.h:45:0,
from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/random.h:10,
from include/linux/net.h:18,
from drivers/infiniband/sw/siw/siw_qp_rx.c:8:
drivers/infiniband/sw/siw/siw_qp_rx.c: In function 'siw_rx_pbl':
drivers/infiniband/sw/siw/siw_qp_rx.c:141:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^
>> drivers/infiniband/sw/siw/siw_qp_rx.c:141:3: note: in expansion of macro 'if'
if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
^
drivers/infiniband/sw/siw/siw_qp_rx.c:141:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^
>> drivers/infiniband/sw/siw/siw_qp_rx.c:141:3: note: in expansion of macro 'if'
if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
^
drivers/infiniband/sw/siw/siw_qp_rx.c:141:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
(cond) ?           ^
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^
>> drivers/infiniband/sw/siw/siw_qp_rx.c:141:3: note: in expansion of macro 'if'
if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
^
drivers/infiniband/sw/siw/siw_qp_rx.c: In function 'siw_proc_send':
drivers/infiniband/sw/siw/siw_qp_rx.c:488:6: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
(void *)(sge->laddr + frx->sge_off),
^
drivers/infiniband/sw/siw/siw_qp_rx.c: In function 'siw_proc_write':
drivers/infiniband/sw/siw/siw_qp_rx.c:601:5: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
(void *)(srx->ddp_to + srx->fpdu_part_rcvd),
^
drivers/infiniband/sw/siw/siw_qp_rx.c: In function 'siw_proc_rresp':
drivers/infiniband/sw/siw/siw_qp_rx.c:844:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
rv = siw_rx_kva(srx, (void *)(sge->laddr + wqe->processed),
^

vim +/if +141 drivers/infiniband/sw/siw/siw_qp_rx.c

8b6a361b8c482f2 Bernard Metzler 2019-06-20    5  
8b6a361b8c482f2 Bernard Metzler 2019-06-20    6  #include <linux/errno.h>
8b6a361b8c482f2 Bernard Metzler 2019-06-20    7  #include <linux/types.h>
8b6a361b8c482f2 Bernard Metzler 2019-06-20   @8  #include <linux/net.h>
8b6a361b8c482f2 Bernard Metzler 2019-06-20    9  #include <linux/scatterlist.h>
8b6a361b8c482f2 Bernard Metzler 2019-06-20   10  #include <linux/highmem.h>
8b6a361b8c482f2 Bernard Metzler 2019-06-20   11  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   12  #include <rdma/iw_cm.h>
8b6a361b8c482f2 Bernard Metzler 2019-06-20   13  #include <rdma/ib_verbs.h>
8b6a361b8c482f2 Bernard Metzler 2019-06-20   14  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   15  #include "siw.h"
8b6a361b8c482f2 Bernard Metzler 2019-06-20   16  #include "siw_verbs.h"
8b6a361b8c482f2 Bernard Metzler 2019-06-20   17  #include "siw_mem.h"
8b6a361b8c482f2 Bernard Metzler 2019-06-20   18  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   19  /*
8b6a361b8c482f2 Bernard Metzler 2019-06-20   20   * siw_rx_umem()
8b6a361b8c482f2 Bernard Metzler 2019-06-20   21   *
8b6a361b8c482f2 Bernard Metzler 2019-06-20   22   * Receive data of @len into target referenced by @dest_addr.
8b6a361b8c482f2 Bernard Metzler 2019-06-20   23   *
8b6a361b8c482f2 Bernard Metzler 2019-06-20   24   * @srx:	Receive Context
8b6a361b8c482f2 Bernard Metzler 2019-06-20   25   * @umem:	siw representation of target memory
8b6a361b8c482f2 Bernard Metzler 2019-06-20   26   * @dest_addr:	user virtual address
8b6a361b8c482f2 Bernard Metzler 2019-06-20   27   * @len:	number of bytes to place
8b6a361b8c482f2 Bernard Metzler 2019-06-20   28   */
8b6a361b8c482f2 Bernard Metzler 2019-06-20   29  static int siw_rx_umem(struct siw_rx_stream *srx, struct siw_umem *umem,
8b6a361b8c482f2 Bernard Metzler 2019-06-20   30  		       u64 dest_addr, int len)
8b6a361b8c482f2 Bernard Metzler 2019-06-20   31  {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   32  	int copied = 0;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   33  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   34  	while (len) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   35  		struct page *p;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   36  		int pg_off, bytes, rv;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   37  		void *dest;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   38  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   39  		p = siw_get_upage(umem, dest_addr);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   40  		if (unlikely(!p)) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   41  			pr_warn("siw: %s: [QP %u]: bogus addr: %p, %p\n",
8b6a361b8c482f2 Bernard Metzler 2019-06-20   42  				__func__, qp_id(rx_qp(srx)),
8b6a361b8c482f2 Bernard Metzler 2019-06-20   43  				(void *)dest_addr, (void *)umem->fp_addr);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   44  			/* siw internal error */
8b6a361b8c482f2 Bernard Metzler 2019-06-20   45  			srx->skb_copied += copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   46  			srx->skb_new -= copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   47  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   48  			return -EFAULT;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   49  		}
8b6a361b8c482f2 Bernard Metzler 2019-06-20   50  		pg_off = dest_addr & ~PAGE_MASK;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   51  		bytes = min(len, (int)PAGE_SIZE - pg_off);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   52  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   53  		siw_dbg_qp(rx_qp(srx), "page %p, bytes=%u\n", p, bytes);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   54  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   55  		dest = kmap_atomic(p);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   56  		rv = skb_copy_bits(srx->skb, srx->skb_offset, dest + pg_off,
8b6a361b8c482f2 Bernard Metzler 2019-06-20   57  				   bytes);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   58  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   59  		if (unlikely(rv)) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   60  			kunmap_atomic(dest);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   61  			srx->skb_copied += copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   62  			srx->skb_new -= copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   63  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   64  			pr_warn("siw: [QP %u]: %s, len %d, page %p, rv %d\n",
8b6a361b8c482f2 Bernard Metzler 2019-06-20   65  				qp_id(rx_qp(srx)), __func__, len, p, rv);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   66  
8b6a361b8c482f2 Bernard Metzler 2019-06-20   67  			return -EFAULT;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   68  		}
8b6a361b8c482f2 Bernard Metzler 2019-06-20   69  		if (srx->mpa_crc_hd) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   70  			if (rx_qp(srx)->kernel_verbs) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   71  				crypto_shash_update(srx->mpa_crc_hd,
8b6a361b8c482f2 Bernard Metzler 2019-06-20   72  					(u8 *)(dest + pg_off), bytes);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   73  				kunmap_atomic(dest);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   74  			} else {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   75  				kunmap_atomic(dest);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   76  				/*
8b6a361b8c482f2 Bernard Metzler 2019-06-20   77  				 * Do CRC on original, not target buffer.
8b6a361b8c482f2 Bernard Metzler 2019-06-20   78  				 * Some user land applications may
8b6a361b8c482f2 Bernard Metzler 2019-06-20   79  				 * concurrently write the target buffer,
8b6a361b8c482f2 Bernard Metzler 2019-06-20   80  				 * which would yield a broken CRC.
8b6a361b8c482f2 Bernard Metzler 2019-06-20   81  				 * Walking the skb twice is very ineffcient.
8b6a361b8c482f2 Bernard Metzler 2019-06-20   82  				 * Folding the CRC into skb_copy_bits()
8b6a361b8c482f2 Bernard Metzler 2019-06-20   83  				 * would be much better, but is currently
8b6a361b8c482f2 Bernard Metzler 2019-06-20   84  				 * not supported.
8b6a361b8c482f2 Bernard Metzler 2019-06-20   85  				 */
8b6a361b8c482f2 Bernard Metzler 2019-06-20   86  				siw_crc_skb(srx, bytes);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   87  			}
8b6a361b8c482f2 Bernard Metzler 2019-06-20   88  		} else {
8b6a361b8c482f2 Bernard Metzler 2019-06-20   89  			kunmap_atomic(dest);
8b6a361b8c482f2 Bernard Metzler 2019-06-20   90  		}
8b6a361b8c482f2 Bernard Metzler 2019-06-20   91  		srx->skb_offset += bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   92  		copied += bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   93  		len -= bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   94  		dest_addr += bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   95  		pg_off = 0;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   96  	}
8b6a361b8c482f2 Bernard Metzler 2019-06-20   97  	srx->skb_copied += copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   98  	srx->skb_new -= copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20   99  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  100  	return copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  101  }
8b6a361b8c482f2 Bernard Metzler 2019-06-20  102  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  103  static int siw_rx_kva(struct siw_rx_stream *srx, void *kva, int len)
8b6a361b8c482f2 Bernard Metzler 2019-06-20  104  {
8b6a361b8c482f2 Bernard Metzler 2019-06-20  105  	int rv;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  106  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  107  	siw_dbg_qp(rx_qp(srx), "kva: 0x%p, len: %u\n", kva, len);
8b6a361b8c482f2 Bernard Metzler 2019-06-20  108  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  109  	rv = skb_copy_bits(srx->skb, srx->skb_offset, kva, len);
8b6a361b8c482f2 Bernard Metzler 2019-06-20  110  	if (unlikely(rv)) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20  111  		pr_warn("siw: [QP %u]: %s, len %d, kva 0x%p, rv %d\n",
8b6a361b8c482f2 Bernard Metzler 2019-06-20  112  			qp_id(rx_qp(srx)), __func__, len, kva, rv);
8b6a361b8c482f2 Bernard Metzler 2019-06-20  113  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  114  		return rv;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  115  	}
8b6a361b8c482f2 Bernard Metzler 2019-06-20  116  	if (srx->mpa_crc_hd)
8b6a361b8c482f2 Bernard Metzler 2019-06-20  117  		crypto_shash_update(srx->mpa_crc_hd, (u8 *)kva, len);
8b6a361b8c482f2 Bernard Metzler 2019-06-20  118  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  119  	srx->skb_offset += len;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  120  	srx->skb_copied += len;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  121  	srx->skb_new -= len;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  122  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  123  	return len;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  124  }
8b6a361b8c482f2 Bernard Metzler 2019-06-20  125  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  126  static int siw_rx_pbl(struct siw_rx_stream *srx, int *pbl_idx,
8b6a361b8c482f2 Bernard Metzler 2019-06-20  127  		      struct siw_mem *mem, u64 addr, int len)
8b6a361b8c482f2 Bernard Metzler 2019-06-20  128  {
8b6a361b8c482f2 Bernard Metzler 2019-06-20  129  	struct siw_pbl *pbl = mem->pbl;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  130  	u64 offset = addr - mem->va;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  131  	int copied = 0;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  132  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  133  	while (len) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20  134  		int bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  135  		u64 buf_addr =
8b6a361b8c482f2 Bernard Metzler 2019-06-20  136  			siw_pbl_get_buffer(pbl, offset, &bytes, pbl_idx);
8b6a361b8c482f2 Bernard Metzler 2019-06-20  137  		if (!buf_addr)
8b6a361b8c482f2 Bernard Metzler 2019-06-20  138  			break;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  139  
8b6a361b8c482f2 Bernard Metzler 2019-06-20  140  		bytes = min(bytes, len);
8b6a361b8c482f2 Bernard Metzler 2019-06-20 @141  		if (siw_rx_kva(srx, (void *)buf_addr, bytes) == bytes) {
8b6a361b8c482f2 Bernard Metzler 2019-06-20  142  			copied += bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  143  			offset += bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  144  			len -= bytes;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  145  		} else {
8b6a361b8c482f2 Bernard Metzler 2019-06-20  146  			break;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  147  		}
8b6a361b8c482f2 Bernard Metzler 2019-06-20  148  	}
8b6a361b8c482f2 Bernard Metzler 2019-06-20  149  	return copied;
8b6a361b8c482f2 Bernard Metzler 2019-06-20  150  }
8b6a361b8c482f2 Bernard Metzler 2019-06-20  151  

:::::: The code at line 141 was first introduced by commit
:::::: 8b6a361b8c482f22ac99c3273285ff16b23fba91 rdma/siw: receive path

:::::: TO: Bernard Metzler <bmt@...ich.ibm.com>
:::::: CC: Jason Gunthorpe <jgg@...lanox.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ