[vfs:uaccess-work.iov_iter 3/5] drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1643:2: warning: ignoring return value of 'copy_from_iter', declared with attribute warn_unused_result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git uaccess-work.iov_iter
head:   ea93a426af164d346a0b4fe0836143bf32177330
commit: aa28de275a248879f9828cb9f7ee7e119c72ff96 [3/5] iov_iter/hardening: move object size checks to inlined part
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout aa28de275a248879f9828cb9f7ee7e119c72ff96
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All warnings (new ones prefixed by >>):

   drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 'kiblnd_send':
>> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1643:2: warning: ignoring return value of 'copy_from_iter', declared with attribute warn_unused_result [-Wunused-result]
     copy_from_iter(&ibmsg->ibm_u.immediate.ibim_payload, IBLND_MSG_SIZE,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             &from);
             ~~~~~~
   drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 'kiblnd_recv':
>> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1744:3: warning: ignoring return value of 'copy_to_iter', declared with attribute warn_unused_result [-Wunused-result]
      copy_to_iter(&rxmsg->ibm_u.immediate.ibim_payload,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            IBLND_MSG_SIZE, to);
            ~~~~~~~~~~~~~~~~~~~

vim +/copy_from_iter +1643 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c

d7e09d039 Peng Tao      2013-05-02  1637  		return -ENOMEM;
d7e09d039 Peng Tao      2013-05-02  1638  	}
d7e09d039 Peng Tao      2013-05-02  1639  
d7e09d039 Peng Tao      2013-05-02  1640  	ibmsg = tx->tx_msg;
d7e09d039 Peng Tao      2013-05-02  1641  	ibmsg->ibm_u.immediate.ibim_hdr = *hdr;
d7e09d039 Peng Tao      2013-05-02  1642  
4cae780e5 Al Viro       2016-08-20 @1643  	copy_from_iter(&ibmsg->ibm_u.immediate.ibim_payload, IBLND_MSG_SIZE,
4cae780e5 Al Viro       2016-08-20  1644  		       &from);
8d9de3f48 James Simmons 2016-06-10  1645  	nob = offsetof(struct kib_immediate_msg, ibim_payload[payload_nob]);
d7e09d039 Peng Tao      2013-05-02  1646  	kiblnd_init_tx_msg(ni, tx, IBLND_MSG_IMMEDIATE, nob);
d7e09d039 Peng Tao      2013-05-02  1647  
d7e09d039 Peng Tao      2013-05-02  1648  	tx->tx_lntmsg[0] = lntmsg;	      /* finalise lntmsg on completion */
d7e09d039 Peng Tao      2013-05-02  1649  	kiblnd_launch_tx(ni, tx, target.nid);
d7e09d039 Peng Tao      2013-05-02  1650  	return 0;
d7e09d039 Peng Tao      2013-05-02  1651  }
d7e09d039 Peng Tao      2013-05-02  1652  
a8046a28c Zi Shen Lim   2014-05-11  1653  static void
21e86fd38 James Simmons 2017-02-26  1654  kiblnd_reply(struct lnet_ni *ni, struct kib_rx *rx, struct lnet_msg *lntmsg)
d7e09d039 Peng Tao      2013-05-02  1655  {
06ef1af8b James Simmons 2017-02-26  1656  	struct lnet_process_id target = lntmsg->msg_target;
d7e09d039 Peng Tao      2013-05-02  1657  	unsigned int niov = lntmsg->msg_niov;
f351bad2b Al Viro       2014-12-02  1658  	struct kvec *iov = lntmsg->msg_iov;
ec72ba7bf James Simmons 2017-02-26  1659  	struct bio_vec *kiov = lntmsg->msg_kiov;
d7e09d039 Peng Tao      2013-05-02  1660  	unsigned int offset = lntmsg->msg_offset;
d7e09d039 Peng Tao      2013-05-02  1661  	unsigned int nob = lntmsg->msg_len;
8d9de3f48 James Simmons 2016-06-10  1662  	struct kib_tx *tx;
d7e09d039 Peng Tao      2013-05-02  1663  	int rc;
d7e09d039 Peng Tao      2013-05-02  1664  
d7e09d039 Peng Tao      2013-05-02  1665  	tx = kiblnd_get_idle_tx(ni, rx->rx_conn->ibc_peer->ibp_nid);
06ace26ed James Simmons 2016-02-12  1666  	if (!tx) {
d7e09d039 Peng Tao      2013-05-02  1667  		CERROR("Can't get tx for REPLY to %s\n",
d7e09d039 Peng Tao      2013-05-02  1668  		       libcfs_nid2str(target.nid));
d7e09d039 Peng Tao      2013-05-02  1669  		goto failed_0;
d7e09d039 Peng Tao      2013-05-02  1670  	}
d7e09d039 Peng Tao      2013-05-02  1671  
5fd88337d James Simmons 2016-02-12  1672  	if (!nob)
d7e09d039 Peng Tao      2013-05-02  1673  		rc = 0;
06ace26ed James Simmons 2016-02-12  1674  	else if (!kiov)
d7e09d039 Peng Tao      2013-05-02  1675  		rc = kiblnd_setup_rd_iov(ni, tx, tx->tx_rd,
d7e09d039 Peng Tao      2013-05-02  1676  					 niov, iov, offset, nob);
d7e09d039 Peng Tao      2013-05-02  1677  	else
d7e09d039 Peng Tao      2013-05-02  1678  		rc = kiblnd_setup_rd_kiov(ni, tx, tx->tx_rd,
d7e09d039 Peng Tao      2013-05-02  1679  					  niov, kiov, offset, nob);
d7e09d039 Peng Tao      2013-05-02  1680  
5fd88337d James Simmons 2016-02-12  1681  	if (rc) {
d7e09d039 Peng Tao      2013-05-02  1682  		CERROR("Can't setup GET src for %s: %d\n",
d7e09d039 Peng Tao      2013-05-02  1683  		       libcfs_nid2str(target.nid), rc);
d7e09d039 Peng Tao      2013-05-02  1684  		goto failed_1;
d7e09d039 Peng Tao      2013-05-02  1685  	}
d7e09d039 Peng Tao      2013-05-02  1686  
d7e09d039 Peng Tao      2013-05-02  1687  	rc = kiblnd_init_rdma(rx->rx_conn, tx,
d7e09d039 Peng Tao      2013-05-02  1688  			      IBLND_MSG_GET_DONE, nob,
d7e09d039 Peng Tao      2013-05-02  1689  			      &rx->rx_msg->ibm_u.get.ibgm_rd,
d7e09d039 Peng Tao      2013-05-02  1690  			      rx->rx_msg->ibm_u.get.ibgm_cookie);
d7e09d039 Peng Tao      2013-05-02  1691  	if (rc < 0) {
d7e09d039 Peng Tao      2013-05-02  1692  		CERROR("Can't setup rdma for GET from %s: %d\n",
d7e09d039 Peng Tao      2013-05-02  1693  		       libcfs_nid2str(target.nid), rc);
d7e09d039 Peng Tao      2013-05-02  1694  		goto failed_1;
d7e09d039 Peng Tao      2013-05-02  1695  	}
d7e09d039 Peng Tao      2013-05-02  1696  
5fd88337d James Simmons 2016-02-12  1697  	if (!nob) {
d7e09d039 Peng Tao      2013-05-02  1698  		/* No RDMA: local completion may happen now! */
d7e09d039 Peng Tao      2013-05-02  1699  		lnet_finalize(ni, lntmsg, 0);
d7e09d039 Peng Tao      2013-05-02  1700  	} else {
4420cfd3f James Simmons 2016-02-12  1701  		/* RDMA: lnet_finalize(lntmsg) when it completes */
d7e09d039 Peng Tao      2013-05-02  1702  		tx->tx_lntmsg[0] = lntmsg;
d7e09d039 Peng Tao      2013-05-02  1703  	}
d7e09d039 Peng Tao      2013-05-02  1704  
d7e09d039 Peng Tao      2013-05-02  1705  	kiblnd_queue_tx(tx, rx->rx_conn);
d7e09d039 Peng Tao      2013-05-02  1706  	return;
d7e09d039 Peng Tao      2013-05-02  1707  
d7e09d039 Peng Tao      2013-05-02  1708   failed_1:
d7e09d039 Peng Tao      2013-05-02  1709  	kiblnd_tx_done(ni, tx);
d7e09d039 Peng Tao      2013-05-02  1710   failed_0:
d7e09d039 Peng Tao      2013-05-02  1711  	lnet_finalize(ni, lntmsg, -EIO);
d7e09d039 Peng Tao      2013-05-02  1712  }
d7e09d039 Peng Tao      2013-05-02  1713  
d7e09d039 Peng Tao      2013-05-02  1714  int
21e86fd38 James Simmons 2017-02-26  1715  kiblnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg,
a9a5ac68c James Simmons 2017-02-26  1716  	    int delayed, struct iov_iter *to, unsigned int rlen)
d7e09d039 Peng Tao      2013-05-02  1717  {
8d9de3f48 James Simmons 2016-06-10  1718  	struct kib_rx *rx = private;
8d9de3f48 James Simmons 2016-06-10  1719  	struct kib_msg *rxmsg = rx->rx_msg;
8d9de3f48 James Simmons 2016-06-10  1720  	struct kib_conn *conn = rx->rx_conn;
8d9de3f48 James Simmons 2016-06-10  1721  	struct kib_tx *tx;
d7e09d039 Peng Tao      2013-05-02  1722  	int nob;
d7e09d039 Peng Tao      2013-05-02  1723  	int post_credit = IBLND_POSTRX_PEER_CREDIT;
d7e09d039 Peng Tao      2013-05-02  1724  	int rc = 0;
d7e09d039 Peng Tao      2013-05-02  1725  
c1b7b8eb8 Al Viro       2016-08-20  1726  	LASSERT(iov_iter_count(to) <= rlen);
d7e09d039 Peng Tao      2013-05-02  1727  	LASSERT(!in_interrupt());
d7e09d039 Peng Tao      2013-05-02  1728  	/* Either all pages or all vaddrs */
d7e09d039 Peng Tao      2013-05-02  1729  
d7e09d039 Peng Tao      2013-05-02  1730  	switch (rxmsg->ibm_type) {
d7e09d039 Peng Tao      2013-05-02  1731  	default:
d7e09d039 Peng Tao      2013-05-02  1732  		LBUG();
d7e09d039 Peng Tao      2013-05-02  1733  
d7e09d039 Peng Tao      2013-05-02  1734  	case IBLND_MSG_IMMEDIATE:
8d9de3f48 James Simmons 2016-06-10  1735  		nob = offsetof(struct kib_msg, ibm_u.immediate.ibim_payload[rlen]);
d7e09d039 Peng Tao      2013-05-02  1736  		if (nob > rx->rx_nob) {
d7e09d039 Peng Tao      2013-05-02  1737  			CERROR("Immediate message from %s too big: %d(%d)\n",
d7e09d039 Peng Tao      2013-05-02  1738  			       libcfs_nid2str(rxmsg->ibm_u.immediate.ibim_hdr.src_nid),
d7e09d039 Peng Tao      2013-05-02  1739  			       nob, rx->rx_nob);
d7e09d039 Peng Tao      2013-05-02  1740  			rc = -EPROTO;
d7e09d039 Peng Tao      2013-05-02  1741  			break;
d7e09d039 Peng Tao      2013-05-02  1742  		}
d7e09d039 Peng Tao      2013-05-02  1743  
4cae780e5 Al Viro       2016-08-20 @1744  		copy_to_iter(&rxmsg->ibm_u.immediate.ibim_payload,
4cae780e5 Al Viro       2016-08-20  1745  			     IBLND_MSG_SIZE, to);
d7e09d039 Peng Tao      2013-05-02  1746  		lnet_finalize(ni, lntmsg, 0);
d7e09d039 Peng Tao      2013-05-02  1747  		break;

:::::: The code at line 1643 was first introduced by commit
:::::: 4cae780e54db3a8d75752bda812547db9f1c1c45 lustre: introduce lnet_copy_{k, }iov2iter(), kill lnet_copy_{k, }iov2{k, }iov()

:::::: TO: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux