linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 11318/11331] drivers/infiniband/core/user_mad.c:564:50: warning: array subscript 'struct ib_rmpp_mad[0]' is partly outside array bounds of 'unsigned char[124]'
@ 2021-08-31  8:04 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-31  8:04 UTC (permalink / raw)
  To: Kees Cook
  Cc: kbuild-all, Linux Memory Management List, Daniel Micay, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 23852 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   93717cde744f9d26aa1b4561f7d9ba2a230459eb
commit: 480e6fe9ccbfa7c7017565deafa843872bf77a50 [11318/11331] slab: add __alloc_size attributes for better bounds checking
config: parisc-buildonly-randconfig-r006-20210831 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0
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://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=480e6fe9ccbfa7c7017565deafa843872bf77a50
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 480e6fe9ccbfa7c7017565deafa843872bf77a50
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=parisc 

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/infiniband/core/user_mad.c: In function 'ib_umad_write':
>> drivers/infiniband/core/user_mad.c:564:50: warning: array subscript 'struct ib_rmpp_mad[0]' is partly outside array bounds of 'unsigned char[124]' [-Warray-bounds]
     564 |         hdr_len = ib_get_mad_data_offset(rmpp_mad->mad_hdr.mgmt_class);
         |                                                  ^~
   drivers/infiniband/core/user_mad.c:509:18: note: referencing an object of size 124 allocated by 'kzalloc.constprop'
     509 |         packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL);
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from drivers/infiniband/core/user_mad.c:38:
   drivers/infiniband/core/user_mad.c:566:42: warning: array subscript 'struct ib_rmpp_mad[0]' is partly outside array bounds of 'unsigned char[124]' [-Warray-bounds]
     566 |         if (ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
         |                                          ^~
   include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
      69 |         (cond) ?                                        \
         |          ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/infiniband/core/user_mad.c:566:9: note: in expansion of macro 'if'
     566 |         if (ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
         |         ^~
   drivers/infiniband/core/user_mad.c:509:18: note: referencing an object of size 124 allocated by 'kzalloc.constprop'
     509 |         packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL);
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/core/user_mad.c:618:25: warning: array subscript 'struct ib_rmpp_mad[0]' is partly outside array bounds of 'unsigned char[124]' [-Warray-bounds]
     618 |                 rmpp_mad->mad_hdr.tid = *tid;
         |                         ^~
   drivers/infiniband/core/user_mad.c:509:18: note: referencing an object of size 124 allocated by 'kzalloc.constprop'
     509 |         packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL);
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from drivers/infiniband/core/user_mad.c:38:
   drivers/infiniband/core/user_mad.c:622:44: warning: array subscript 'struct ib_rmpp_mad[0]' is partly outside array bounds of 'unsigned char[124]' [-Warray-bounds]
     622 |            && ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
         |                                            ^~
   include/linux/compiler.h:69:10: note: in definition of macro '__trace_if_value'
      69 |         (cond) ?                                        \
         |          ^~~~
   include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
      56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
         |                            ^~~~~~~~~~~~~~
   drivers/infiniband/core/user_mad.c:621:9: note: in expansion of macro 'if'
     621 |         if (!ib_mad_kernel_rmpp_agent(agent)
         |         ^~
   drivers/infiniband/core/user_mad.c:509:18: note: referencing an object of size 124 allocated by 'kzalloc.constprop'
     509 |         packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL);
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/big_endian.h:13,
                    from include/linux/byteorder/big_endian.h:5,
                    from arch/parisc/include/uapi/asm/byteorder.h:5,
                    from arch/parisc/include/asm/bitops.h:11,
                    from include/linux/bitops.h:33,
                    from include/linux/kernel.h:12,
                    from drivers/scsi/mpt3sas/mpt3sas_base.c:46:
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_assign_fw_reported_qd':
>> drivers/scsi/mpt3sas/mpt3sas_base.c:5406:40: warning: array subscript 'Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]' is partly outside array bounds of 'unsigned char[20]' [-Warray-bounds]
    5406 |             (le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth)) ?
         |                                        ^~
   include/uapi/linux/swab.h:105:39: note: in definition of macro '__swab16'
     105 |         (__builtin_constant_p((__u16)(x)) ?     \
         |                                       ^
   include/linux/byteorder/generic.h:91:21: note: in expansion of macro '__le16_to_cpu'
      91 | #define le16_to_cpu __le16_to_cpu
         |                     ^~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:5406:14: note: in expansion of macro 'le16_to_cpu'
    5406 |             (le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth)) ?
         |              ^~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:5392:26: note: referencing an object of size 20 allocated by 'kzalloc'
    5392 |         sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
         |                          ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/big_endian.h:13,
                    from include/linux/byteorder/big_endian.h:5,
                    from arch/parisc/include/uapi/asm/byteorder.h:5,
                    from arch/parisc/include/asm/bitops.h:11,
                    from include/linux/bitops.h:33,
                    from include/linux/kernel.h:12,
                    from drivers/scsi/mpt3sas/mpt3sas_base.c:46:
   drivers/scsi/mpt3sas/mpt3sas_base.c:5410:40: warning: array subscript 'Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]' is partly outside array bounds of 'unsigned char[20]' [-Warray-bounds]
    5410 |             (le16_to_cpu(sas_iounit_pg1->SASNarrowMaxQueueDepth)) ?
         |                                        ^~
   include/uapi/linux/swab.h:105:39: note: in definition of macro '__swab16'
     105 |         (__builtin_constant_p((__u16)(x)) ?     \
         |                                       ^
   include/linux/byteorder/generic.h:91:21: note: in expansion of macro '__le16_to_cpu'
      91 | #define le16_to_cpu __le16_to_cpu
         |                     ^~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:5410:14: note: in expansion of macro 'le16_to_cpu'
    5410 |             (le16_to_cpu(sas_iounit_pg1->SASNarrowMaxQueueDepth)) ?
         |              ^~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:5392:26: note: referencing an object of size 20 allocated by 'kzalloc'
    5392 |         sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
         |                          ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:5413:43: warning: array subscript 'Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]' is partly outside array bounds of 'unsigned char[20]' [-Warray-bounds]
    5413 |         ioc->max_sata_qd = (sas_iounit_pg1->SATAMaxQDepth) ?
         |                                           ^~
   drivers/scsi/mpt3sas/mpt3sas_base.c:5392:26: note: referencing an object of size 20 allocated by 'kzalloc'
    5392 |         sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
         |                          ^~~~~~~~~~~~~~~~~~~~~~~


vim +564 drivers/infiniband/core/user_mad.c

2527e681fd4fd4 Sean Hefty                  2006-07-20  492  
^1da177e4c3f41 Linus Torvalds              2005-04-16  493  static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
^1da177e4c3f41 Linus Torvalds              2005-04-16  494  			     size_t count, loff_t *pos)
^1da177e4c3f41 Linus Torvalds              2005-04-16  495  {
^1da177e4c3f41 Linus Torvalds              2005-04-16  496  	struct ib_umad_file *file = filp->private_data;
^1da177e4c3f41 Linus Torvalds              2005-04-16  497  	struct ib_umad_packet *packet;
^1da177e4c3f41 Linus Torvalds              2005-04-16  498  	struct ib_mad_agent *agent;
90898850ec4e7b Dasaratharaman Chandramouli 2017-04-29  499  	struct rdma_ah_attr ah_attr;
34816ad98efe4d Sean Hefty                  2005-10-25  500  	struct ib_ah *ah;
cb183a06b38165 Hal Rosenstock              2005-07-27  501  	struct ib_rmpp_mad *rmpp_mad;
97f52eb438be7c Sean Hefty                  2005-08-13  502  	__be64 *tid;
f36e1793e25513 Jack Morgenstein            2006-03-03  503  	int ret, data_len, hdr_len, copy_offset, rmpp_active;
8e4349d13f3365 Ira Weiny                   2015-06-10  504  	u8 base_version;
^1da177e4c3f41 Linus Torvalds              2005-04-16  505  
2be8e3ee8efd6f Roland Dreier               2007-10-09  506  	if (count < hdr_size(file) + IB_MGMT_RMPP_HDR)
^1da177e4c3f41 Linus Torvalds              2005-04-16  507  		return -EINVAL;
^1da177e4c3f41 Linus Torvalds              2005-04-16  508  
f36e1793e25513 Jack Morgenstein            2006-03-03  509  	packet = kzalloc(sizeof *packet + IB_MGMT_RMPP_HDR, GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds              2005-04-16  510  	if (!packet)
^1da177e4c3f41 Linus Torvalds              2005-04-16  511  		return -ENOMEM;
^1da177e4c3f41 Linus Torvalds              2005-04-16  512  
2be8e3ee8efd6f Roland Dreier               2007-10-09  513  	if (copy_from_user(&packet->mad, buf, hdr_size(file))) {
cb183a06b38165 Hal Rosenstock              2005-07-27  514  		ret = -EFAULT;
cb183a06b38165 Hal Rosenstock              2005-07-27  515  		goto err;
^1da177e4c3f41 Linus Torvalds              2005-04-16  516  	}
^1da177e4c3f41 Linus Torvalds              2005-04-16  517  
caf6e3f221ddc1 Hefty, Sean                 2011-10-06  518  	if (packet->mad.hdr.id >= IB_UMAD_MAX_AGENTS) {
^1da177e4c3f41 Linus Torvalds              2005-04-16  519  		ret = -EINVAL;
^1da177e4c3f41 Linus Torvalds              2005-04-16  520  		goto err;
^1da177e4c3f41 Linus Torvalds              2005-04-16  521  	}
^1da177e4c3f41 Linus Torvalds              2005-04-16  522  
2be8e3ee8efd6f Roland Dreier               2007-10-09  523  	buf += hdr_size(file);
2be8e3ee8efd6f Roland Dreier               2007-10-09  524  
2be8e3ee8efd6f Roland Dreier               2007-10-09  525  	if (copy_from_user(packet->mad.data, buf, IB_MGMT_RMPP_HDR)) {
2be8e3ee8efd6f Roland Dreier               2007-10-09  526  		ret = -EFAULT;
2be8e3ee8efd6f Roland Dreier               2007-10-09  527  		goto err;
2be8e3ee8efd6f Roland Dreier               2007-10-09  528  	}
2be8e3ee8efd6f Roland Dreier               2007-10-09  529  
2fe7e6f7c9f55e Roland Dreier               2008-01-25  530  	mutex_lock(&file->mutex);
^1da177e4c3f41 Linus Torvalds              2005-04-16  531  
056533192a9e04 Ira Weiny                   2019-03-19  532  	trace_ib_umad_write(file, &packet->mad.hdr,
056533192a9e04 Ira Weiny                   2019-03-19  533  			    (struct ib_mad_hdr *)&packet->mad.data);
056533192a9e04 Ira Weiny                   2019-03-19  534  
94382f3562e350 Roland Dreier               2005-11-10  535  	agent = __get_agent(file, packet->mad.hdr.id);
^1da177e4c3f41 Linus Torvalds              2005-04-16  536  	if (!agent) {
4fc5461823c9ca Shay Drory                  2021-01-25  537  		ret = -EIO;
^1da177e4c3f41 Linus Torvalds              2005-04-16  538  		goto err_up;
^1da177e4c3f41 Linus Torvalds              2005-04-16  539  	}
^1da177e4c3f41 Linus Torvalds              2005-04-16  540  
^1da177e4c3f41 Linus Torvalds              2005-04-16  541  	memset(&ah_attr, 0, sizeof ah_attr);
f23a5350e43c81 Jack Morgenstein            2018-01-28  542  	ah_attr.type = rdma_ah_find_type(agent->device,
44c58487d51a0d Dasaratharaman Chandramouli 2017-04-29  543  					 file->port->port_num);
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  544  	rdma_ah_set_dlid(&ah_attr, be16_to_cpu(packet->mad.hdr.lid));
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  545  	rdma_ah_set_sl(&ah_attr, packet->mad.hdr.sl);
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  546  	rdma_ah_set_path_bits(&ah_attr, packet->mad.hdr.path_bits);
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  547  	rdma_ah_set_port_num(&ah_attr, file->port->port_num);
cb183a06b38165 Hal Rosenstock              2005-07-27  548  	if (packet->mad.hdr.grh_present) {
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  549  		rdma_ah_set_grh(&ah_attr, NULL,
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  550  				be32_to_cpu(packet->mad.hdr.flow_label),
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  551  				packet->mad.hdr.gid_index,
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  552  				packet->mad.hdr.hop_limit,
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  553  				packet->mad.hdr.traffic_class);
d8966fcd4c2570 Dasaratharaman Chandramouli 2017-04-29  554  		rdma_ah_set_dgid_raw(&ah_attr, packet->mad.hdr.gid);
^1da177e4c3f41 Linus Torvalds              2005-04-16  555  	}
^1da177e4c3f41 Linus Torvalds              2005-04-16  556  
5cda6587feec79 Parav Pandit                2017-10-16  557  	ah = rdma_create_user_ah(agent->qp->pd, &ah_attr, NULL);
34816ad98efe4d Sean Hefty                  2005-10-25  558  	if (IS_ERR(ah)) {
34816ad98efe4d Sean Hefty                  2005-10-25  559  		ret = PTR_ERR(ah);
^1da177e4c3f41 Linus Torvalds              2005-04-16  560  		goto err_up;
^1da177e4c3f41 Linus Torvalds              2005-04-16  561  	}
^1da177e4c3f41 Linus Torvalds              2005-04-16  562  
cb183a06b38165 Hal Rosenstock              2005-07-27  563  	rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data;
618a3c03fcfdf1 Hal Rosenstock              2006-03-28 @564  	hdr_len = ib_get_mad_data_offset(rmpp_mad->mad_hdr.mgmt_class);
1471cb6ca67990 Ira Weiny                   2014-08-08  565  
1471cb6ca67990 Ira Weiny                   2014-08-08  566  	if (ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
1471cb6ca67990 Ira Weiny                   2014-08-08  567  	    && ib_mad_kernel_rmpp_agent(agent)) {
cb0f0910f4b417 Sean Hefty                  2005-10-27  568  		copy_offset = IB_MGMT_RMPP_HDR;
f36e1793e25513 Jack Morgenstein            2006-03-03  569  		rmpp_active = ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) &
f36e1793e25513 Jack Morgenstein            2006-03-03  570  						IB_MGMT_RMPP_FLAG_ACTIVE;
1471cb6ca67990 Ira Weiny                   2014-08-08  571  	} else {
1471cb6ca67990 Ira Weiny                   2014-08-08  572  		copy_offset = IB_MGMT_MAD_HDR;
1471cb6ca67990 Ira Weiny                   2014-08-08  573  		rmpp_active = 0;
cb183a06b38165 Hal Rosenstock              2005-07-27  574  	}
cb183a06b38165 Hal Rosenstock              2005-07-27  575  
8e4349d13f3365 Ira Weiny                   2015-06-10  576  	base_version = ((struct ib_mad_hdr *)&packet->mad.data)->base_version;
2be8e3ee8efd6f Roland Dreier               2007-10-09  577  	data_len = count - hdr_size(file) - hdr_len;
cb183a06b38165 Hal Rosenstock              2005-07-27  578  	packet->msg = ib_create_send_mad(agent,
cb183a06b38165 Hal Rosenstock              2005-07-27  579  					 be32_to_cpu(packet->mad.hdr.qpn),
2be8e3ee8efd6f Roland Dreier               2007-10-09  580  					 packet->mad.hdr.pkey_index, rmpp_active,
da2dfaa3a35cb5 Ira Weiny                   2015-06-06  581  					 hdr_len, data_len, GFP_KERNEL,
8e4349d13f3365 Ira Weiny                   2015-06-10  582  					 base_version);
cb183a06b38165 Hal Rosenstock              2005-07-27  583  	if (IS_ERR(packet->msg)) {
cb183a06b38165 Hal Rosenstock              2005-07-27  584  		ret = PTR_ERR(packet->msg);
cb183a06b38165 Hal Rosenstock              2005-07-27  585  		goto err_ah;
cb183a06b38165 Hal Rosenstock              2005-07-27  586  	}
cb183a06b38165 Hal Rosenstock              2005-07-27  587  
34816ad98efe4d Sean Hefty                  2005-10-25  588  	packet->msg->ah		= ah;
34816ad98efe4d Sean Hefty                  2005-10-25  589  	packet->msg->timeout_ms = packet->mad.hdr.timeout_ms;
34816ad98efe4d Sean Hefty                  2005-10-25  590  	packet->msg->retries	= packet->mad.hdr.retries;
34816ad98efe4d Sean Hefty                  2005-10-25  591  	packet->msg->context[0] = packet;
^1da177e4c3f41 Linus Torvalds              2005-04-16  592  
f36e1793e25513 Jack Morgenstein            2006-03-03  593  	/* Copy MAD header.  Any RMPP header is already in place. */
cb0f0910f4b417 Sean Hefty                  2005-10-27  594  	memcpy(packet->msg->mad, packet->mad.data, IB_MGMT_MAD_HDR);
f36e1793e25513 Jack Morgenstein            2006-03-03  595  
f36e1793e25513 Jack Morgenstein            2006-03-03  596  	if (!rmpp_active) {
cb0f0910f4b417 Sean Hefty                  2005-10-27  597  		if (copy_from_user(packet->msg->mad + copy_offset,
f36e1793e25513 Jack Morgenstein            2006-03-03  598  				   buf + copy_offset,
f36e1793e25513 Jack Morgenstein            2006-03-03  599  				   hdr_len + data_len - copy_offset)) {
cb183a06b38165 Hal Rosenstock              2005-07-27  600  			ret = -EFAULT;
cb183a06b38165 Hal Rosenstock              2005-07-27  601  			goto err_msg;
cb183a06b38165 Hal Rosenstock              2005-07-27  602  		}
f36e1793e25513 Jack Morgenstein            2006-03-03  603  	} else {
f36e1793e25513 Jack Morgenstein            2006-03-03  604  		ret = copy_rmpp_mad(packet->msg, buf);
f36e1793e25513 Jack Morgenstein            2006-03-03  605  		if (ret)
f36e1793e25513 Jack Morgenstein            2006-03-03  606  			goto err_msg;
f36e1793e25513 Jack Morgenstein            2006-03-03  607  	}
^1da177e4c3f41 Linus Torvalds              2005-04-16  608  
cb183a06b38165 Hal Rosenstock              2005-07-27  609  	/*
2527e681fd4fd4 Sean Hefty                  2006-07-20  610  	 * Set the high-order part of the transaction ID to make MADs from
2527e681fd4fd4 Sean Hefty                  2006-07-20  611  	 * different agents unique, and allow routing responses back to the
2527e681fd4fd4 Sean Hefty                  2006-07-20  612  	 * original requestor.
cb183a06b38165 Hal Rosenstock              2005-07-27  613  	 */
2527e681fd4fd4 Sean Hefty                  2006-07-20  614  	if (!ib_response_mad(packet->msg->mad)) {
089a1bedd84be1 Roland Dreier               2005-10-27  615  		tid = &((struct ib_mad_hdr *) packet->msg->mad)->tid;
cb183a06b38165 Hal Rosenstock              2005-07-27  616  		*tid = cpu_to_be64(((u64) agent->hi_tid) << 32 |
cb183a06b38165 Hal Rosenstock              2005-07-27  617  				   (be64_to_cpup(tid) & 0xffffffff));
2527e681fd4fd4 Sean Hefty                  2006-07-20  618  		rmpp_mad->mad_hdr.tid = *tid;
2527e681fd4fd4 Sean Hefty                  2006-07-20  619  	}
2527e681fd4fd4 Sean Hefty                  2006-07-20  620  
1471cb6ca67990 Ira Weiny                   2014-08-08  621  	if (!ib_mad_kernel_rmpp_agent(agent)
1471cb6ca67990 Ira Weiny                   2014-08-08  622  	   && ib_is_mad_class_rmpp(rmpp_mad->mad_hdr.mgmt_class)
1471cb6ca67990 Ira Weiny                   2014-08-08  623  	   && (ib_get_rmpp_flags(&rmpp_mad->rmpp_hdr) & IB_MGMT_RMPP_FLAG_ACTIVE)) {
1471cb6ca67990 Ira Weiny                   2014-08-08  624  		spin_lock_irq(&file->send_lock);
1471cb6ca67990 Ira Weiny                   2014-08-08  625  		list_add_tail(&packet->list, &file->send_list);
1471cb6ca67990 Ira Weiny                   2014-08-08  626  		spin_unlock_irq(&file->send_lock);
1471cb6ca67990 Ira Weiny                   2014-08-08  627  	} else {
2527e681fd4fd4 Sean Hefty                  2006-07-20  628  		spin_lock_irq(&file->send_lock);
2527e681fd4fd4 Sean Hefty                  2006-07-20  629  		ret = is_duplicate(file, packet);
2527e681fd4fd4 Sean Hefty                  2006-07-20  630  		if (!ret)
2527e681fd4fd4 Sean Hefty                  2006-07-20  631  			list_add_tail(&packet->list, &file->send_list);
2527e681fd4fd4 Sean Hefty                  2006-07-20  632  		spin_unlock_irq(&file->send_lock);
2527e681fd4fd4 Sean Hefty                  2006-07-20  633  		if (ret) {
2527e681fd4fd4 Sean Hefty                  2006-07-20  634  			ret = -EINVAL;
2527e681fd4fd4 Sean Hefty                  2006-07-20  635  			goto err_msg;
cb183a06b38165 Hal Rosenstock              2005-07-27  636  		}
1471cb6ca67990 Ira Weiny                   2014-08-08  637  	}
cb183a06b38165 Hal Rosenstock              2005-07-27  638  
34816ad98efe4d Sean Hefty                  2005-10-25  639  	ret = ib_post_send_mad(packet->msg, NULL);
cb183a06b38165 Hal Rosenstock              2005-07-27  640  	if (ret)
2527e681fd4fd4 Sean Hefty                  2006-07-20  641  		goto err_send;
cb183a06b38165 Hal Rosenstock              2005-07-27  642  
2fe7e6f7c9f55e Roland Dreier               2008-01-25  643  	mutex_unlock(&file->mutex);
cb0f0910f4b417 Sean Hefty                  2005-10-27  644  	return count;
cb183a06b38165 Hal Rosenstock              2005-07-27  645  
2527e681fd4fd4 Sean Hefty                  2006-07-20  646  err_send:
2527e681fd4fd4 Sean Hefty                  2006-07-20  647  	dequeue_send(file, packet);
cb183a06b38165 Hal Rosenstock              2005-07-27  648  err_msg:
cb183a06b38165 Hal Rosenstock              2005-07-27  649  	ib_free_send_mad(packet->msg);
cb183a06b38165 Hal Rosenstock              2005-07-27  650  err_ah:
2553ba217eea37 Gal Pressman                2018-12-12  651  	rdma_destroy_ah(ah, RDMA_DESTROY_AH_SLEEPABLE);
^1da177e4c3f41 Linus Torvalds              2005-04-16  652  err_up:
2fe7e6f7c9f55e Roland Dreier               2008-01-25  653  	mutex_unlock(&file->mutex);
^1da177e4c3f41 Linus Torvalds              2005-04-16  654  err:
^1da177e4c3f41 Linus Torvalds              2005-04-16  655  	kfree(packet);
^1da177e4c3f41 Linus Torvalds              2005-04-16  656  	return ret;
^1da177e4c3f41 Linus Torvalds              2005-04-16  657  }
^1da177e4c3f41 Linus Torvalds              2005-04-16  658  

:::::: The code at line 564 was first introduced by commit
:::::: 618a3c03fcfdf1ac4543247c8ddfb0c9d775ff33 IB/mad: RMPP support for additional classes

:::::: TO: Hal Rosenstock <halr@voltaire.com>
:::::: CC: Roland Dreier <rolandd@cisco.com>

---
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: 39591 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-31  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31  8:04 [linux-next:master 11318/11331] drivers/infiniband/core/user_mad.c:564:50: warning: array subscript 'struct ib_rmpp_mad[0]' is partly outside array bounds of 'unsigned char[124]' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).