CC: [email protected]
CC: [email protected]
TO: Leon Romanovsky <[email protected]>
CC: Jason Gunthorpe <[email protected]>
CC: Mark Zhang <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   1fe5501ba1abf2b7e78295df73675423bd6899a0
commit: 50aec2c3135efd985291adc2e4d1278d52b03de9 RDMA/mlx5: Return ECE data 
after modify QP
date:   11 months ago
:::::: branch date: 15 hours ago
:::::: commit date: 11 months ago
config: x86_64-randconfig-m001-20210421 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/infiniband/hw/mlx5/qp.c:4306 mlx5_ib_modify_qp() error: we previously 
assumed 'udata' could be null (see line 4200)

vim +/udata +4306 drivers/infiniband/hw/mlx5/qp.c

776a3906b69296 Moni Shoua      2018-01-02  4184  
e126ba97dba9ed Eli Cohen       2013-07-07  4185  int mlx5_ib_modify_qp(struct 
ib_qp *ibqp, struct ib_qp_attr *attr,
e126ba97dba9ed Eli Cohen       2013-07-07  4186                       int 
attr_mask, struct ib_udata *udata)
e126ba97dba9ed Eli Cohen       2013-07-07  4187  {
e126ba97dba9ed Eli Cohen       2013-07-07  4188         struct mlx5_ib_dev *dev 
= to_mdev(ibqp->device);
50aec2c3135efd Leon Romanovsky 2020-05-26  4189         struct 
mlx5_ib_modify_qp_resp resp = {};
e126ba97dba9ed Eli Cohen       2013-07-07  4190         struct mlx5_ib_qp *qp = 
to_mqp(ibqp);
61147f391a8b3b Bodong Wang     2018-03-19  4191         struct 
mlx5_ib_modify_qp ucmd = {};
d16e91daf446c6 Haggai Eran     2016-02-29  4192         enum ib_qp_type qp_type;
e126ba97dba9ed Eli Cohen       2013-07-07  4193         enum ib_qp_state 
cur_state, new_state;
e126ba97dba9ed Eli Cohen       2013-07-07  4194         int err = -EINVAL;
e126ba97dba9ed Eli Cohen       2013-07-07  4195         int port;
e126ba97dba9ed Eli Cohen       2013-07-07  4196  
28d6137008b2aa Yishai Hadas    2016-05-23  4197         if (ibqp->rwq_ind_tbl)
28d6137008b2aa Yishai Hadas    2016-05-23  4198                 return -ENOSYS;
28d6137008b2aa Yishai Hadas    2016-05-23  4199  
61147f391a8b3b Bodong Wang     2018-03-19 @4200         if (udata && 
udata->inlen) {
5f62a521ff20e0 Leon Romanovsky 2020-05-26  4201                 if 
(udata->inlen < offsetofend(typeof(ucmd), ece_options))
61147f391a8b3b Bodong Wang     2018-03-19  4202                         return 
-EINVAL;
61147f391a8b3b Bodong Wang     2018-03-19  4203  
61147f391a8b3b Bodong Wang     2018-03-19  4204                 if 
(udata->inlen > sizeof(ucmd) &&
61147f391a8b3b Bodong Wang     2018-03-19  4205                     
!ib_is_udata_cleared(udata, sizeof(ucmd),
61147f391a8b3b Bodong Wang     2018-03-19  4206                                 
         udata->inlen - sizeof(ucmd)))
61147f391a8b3b Bodong Wang     2018-03-19  4207                         return 
-EOPNOTSUPP;
61147f391a8b3b Bodong Wang     2018-03-19  4208  
61147f391a8b3b Bodong Wang     2018-03-19  4209                 if 
(ib_copy_from_udata(&ucmd, udata,
61147f391a8b3b Bodong Wang     2018-03-19  4210                                 
       min(udata->inlen, sizeof(ucmd))))
61147f391a8b3b Bodong Wang     2018-03-19  4211                         return 
-EFAULT;
61147f391a8b3b Bodong Wang     2018-03-19  4212  
61147f391a8b3b Bodong Wang     2018-03-19  4213                 if 
(ucmd.comp_mask ||
61147f391a8b3b Bodong Wang     2018-03-19  4214                     
memchr_inv(&ucmd.burst_info.reserved, 0,
61147f391a8b3b Bodong Wang     2018-03-19  4215                                
sizeof(ucmd.burst_info.reserved)))
61147f391a8b3b Bodong Wang     2018-03-19  4216                         return 
-EOPNOTSUPP;
5f62a521ff20e0 Leon Romanovsky 2020-05-26  4217  
61147f391a8b3b Bodong Wang     2018-03-19  4218         }
61147f391a8b3b Bodong Wang     2018-03-19  4219  
d16e91daf446c6 Haggai Eran     2016-02-29  4220         if 
(unlikely(ibqp->qp_type == IB_QPT_GSI))
d16e91daf446c6 Haggai Eran     2016-02-29  4221                 return 
mlx5_ib_gsi_modify_qp(ibqp, attr, attr_mask);
d16e91daf446c6 Haggai Eran     2016-02-29  4222  
7aede1a25f4b84 Leon Romanovsky 2020-04-27  4223         qp_type = 
(unlikely(ibqp->qp_type == MLX5_IB_QPT_HW_GSI)) ? IB_QPT_GSI :
7aede1a25f4b84 Leon Romanovsky 2020-04-27  4224                                 
                                    qp->type;
d16e91daf446c6 Haggai Eran     2016-02-29  4225  
5f62a521ff20e0 Leon Romanovsky 2020-05-26  4226         if (qp_type == 
MLX5_IB_QPT_DCT) {
5f62a521ff20e0 Leon Romanovsky 2020-05-26  4227                 if 
(memchr_inv(&ucmd.ece_options, 0, sizeof(ucmd.ece_options)))
5f62a521ff20e0 Leon Romanovsky 2020-05-26  4228                         return 
-EOPNOTSUPP;
5f62a521ff20e0 Leon Romanovsky 2020-05-26  4229  
776a3906b69296 Moni Shoua      2018-01-02  4230                 return 
mlx5_ib_modify_dct(ibqp, attr, attr_mask, udata);
5f62a521ff20e0 Leon Romanovsky 2020-05-26  4231         }
c32a4f296e1dc2 Moni Shoua      2018-01-02  4232  
e126ba97dba9ed Eli Cohen       2013-07-07  4233         mutex_lock(&qp->mutex);
e126ba97dba9ed Eli Cohen       2013-07-07  4234  
e126ba97dba9ed Eli Cohen       2013-07-07  4235         cur_state = attr_mask & 
IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state;
e126ba97dba9ed Eli Cohen       2013-07-07  4236         new_state = attr_mask & 
IB_QP_STATE ? attr->qp_state : cur_state;
e126ba97dba9ed Eli Cohen       2013-07-07  4237  
2811ba51b04958 Achiad Shochat  2015-12-23  4238         if (!(cur_state == 
new_state && cur_state == IB_QPS_RESET)) {
2811ba51b04958 Achiad Shochat  2015-12-23  4239                 port = 
attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
2811ba51b04958 Achiad Shochat  2015-12-23  4240         }
2811ba51b04958 Achiad Shochat  2015-12-23  4241  
2be08c308f102e Leon Romanovsky 2020-04-27  4242         if (qp->flags & 
IB_QP_CREATE_SOURCE_QPN) {
c2e53b2ce1ba35 Yishai Hadas    2017-06-08  4243                 if (attr_mask & 
~(IB_QP_STATE | IB_QP_CUR_STATE)) {
c2e53b2ce1ba35 Yishai Hadas    2017-06-08  4244                         
mlx5_ib_dbg(dev, "invalid attr_mask 0x%x when underlay QP is used\n",
c2e53b2ce1ba35 Yishai Hadas    2017-06-08  4245                                 
    attr_mask);
c2e53b2ce1ba35 Yishai Hadas    2017-06-08  4246                         goto 
out;
c2e53b2ce1ba35 Yishai Hadas    2017-06-08  4247                 }
c2e53b2ce1ba35 Yishai Hadas    2017-06-08  4248         } else if (qp_type != 
MLX5_IB_QPT_REG_UMR &&
c32a4f296e1dc2 Moni Shoua      2018-01-02  4249                    qp_type != 
MLX5_IB_QPT_DCI &&
d31131bba5a163 Kamal Heib      2018-10-02  4250                    
!ib_modify_qp_is_ok(cur_state, new_state, qp_type,
d31131bba5a163 Kamal Heib      2018-10-02  4251                                 
       attr_mask)) {
158abf862a2947 Haggai Eran     2016-02-29  4252                 
mlx5_ib_dbg(dev, "invalid QP state transition from %d to %d, qp_type %d, 
attr_mask 0x%x\n",
158abf862a2947 Haggai Eran     2016-02-29  4253                             
cur_state, new_state, ibqp->qp_type, attr_mask);
e126ba97dba9ed Eli Cohen       2013-07-07  4254                 goto out;
c32a4f296e1dc2 Moni Shoua      2018-01-02  4255         } else if (qp_type == 
MLX5_IB_QPT_DCI &&
c32a4f296e1dc2 Moni Shoua      2018-01-02  4256                    
!modify_dci_qp_is_ok(cur_state, new_state, attr_mask)) {
c32a4f296e1dc2 Moni Shoua      2018-01-02  4257                 
mlx5_ib_dbg(dev, "invalid QP state transition from %d to %d, qp_type %d, 
attr_mask 0x%x\n",
c32a4f296e1dc2 Moni Shoua      2018-01-02  4258                             
cur_state, new_state, qp_type, attr_mask);
c32a4f296e1dc2 Moni Shoua      2018-01-02  4259                 goto out;
158abf862a2947 Haggai Eran     2016-02-29  4260         }
e126ba97dba9ed Eli Cohen       2013-07-07  4261  
e126ba97dba9ed Eli Cohen       2013-07-07  4262         if ((attr_mask & 
IB_QP_PORT) &&
938fe83c8dcbbf Saeed Mahameed  2015-05-28  4263             (attr->port_num == 
0 ||
508562d6f70888 Daniel Jurgens  2018-01-04  4264              attr->port_num > 
dev->num_ports)) {
158abf862a2947 Haggai Eran     2016-02-29  4265                 
mlx5_ib_dbg(dev, "invalid port number %d. number of ports is %d\n",
158abf862a2947 Haggai Eran     2016-02-29  4266                             
attr->port_num, dev->num_ports);
e126ba97dba9ed Eli Cohen       2013-07-07  4267                 goto out;
158abf862a2947 Haggai Eran     2016-02-29  4268         }
e126ba97dba9ed Eli Cohen       2013-07-07  4269  
e126ba97dba9ed Eli Cohen       2013-07-07  4270         if (attr_mask & 
IB_QP_PKEY_INDEX) {
e126ba97dba9ed Eli Cohen       2013-07-07  4271                 port = 
attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
938fe83c8dcbbf Saeed Mahameed  2015-05-28  4272                 if 
(attr->pkey_index >=
158abf862a2947 Haggai Eran     2016-02-29  4273                     
dev->mdev->port_caps[port - 1].pkey_table_len) {
158abf862a2947 Haggai Eran     2016-02-29  4274                         
mlx5_ib_dbg(dev, "invalid pkey index %d\n",
158abf862a2947 Haggai Eran     2016-02-29  4275                                 
    attr->pkey_index);
e126ba97dba9ed Eli Cohen       2013-07-07  4276                         goto 
out;
e126ba97dba9ed Eli Cohen       2013-07-07  4277                 }
158abf862a2947 Haggai Eran     2016-02-29  4278         }
e126ba97dba9ed Eli Cohen       2013-07-07  4279  
e126ba97dba9ed Eli Cohen       2013-07-07  4280         if (attr_mask & 
IB_QP_MAX_QP_RD_ATOMIC &&
938fe83c8dcbbf Saeed Mahameed  2015-05-28  4281             attr->max_rd_atomic 
>
158abf862a2947 Haggai Eran     2016-02-29  4282             (1 << 
MLX5_CAP_GEN(dev->mdev, log_max_ra_res_qp))) {
158abf862a2947 Haggai Eran     2016-02-29  4283                 
mlx5_ib_dbg(dev, "invalid max_rd_atomic value %d\n",
158abf862a2947 Haggai Eran     2016-02-29  4284                             
attr->max_rd_atomic);
e126ba97dba9ed Eli Cohen       2013-07-07  4285                 goto out;
158abf862a2947 Haggai Eran     2016-02-29  4286         }
e126ba97dba9ed Eli Cohen       2013-07-07  4287  
e126ba97dba9ed Eli Cohen       2013-07-07  4288         if (attr_mask & 
IB_QP_MAX_DEST_RD_ATOMIC &&
938fe83c8dcbbf Saeed Mahameed  2015-05-28  4289             
attr->max_dest_rd_atomic >
158abf862a2947 Haggai Eran     2016-02-29  4290             (1 << 
MLX5_CAP_GEN(dev->mdev, log_max_ra_req_qp))) {
158abf862a2947 Haggai Eran     2016-02-29  4291                 
mlx5_ib_dbg(dev, "invalid max_dest_rd_atomic value %d\n",
158abf862a2947 Haggai Eran     2016-02-29  4292                             
attr->max_dest_rd_atomic);
e126ba97dba9ed Eli Cohen       2013-07-07  4293                 goto out;
158abf862a2947 Haggai Eran     2016-02-29  4294         }
e126ba97dba9ed Eli Cohen       2013-07-07  4295  
e126ba97dba9ed Eli Cohen       2013-07-07  4296         if (cur_state == 
new_state && cur_state == IB_QPS_RESET) {
e126ba97dba9ed Eli Cohen       2013-07-07  4297                 err = 0;
e126ba97dba9ed Eli Cohen       2013-07-07  4298                 goto out;
e126ba97dba9ed Eli Cohen       2013-07-07  4299         }
e126ba97dba9ed Eli Cohen       2013-07-07  4300  
61147f391a8b3b Bodong Wang     2018-03-19  4301         err = 
__mlx5_ib_modify_qp(ibqp, attr, attr_mask, cur_state,
50aec2c3135efd Leon Romanovsky 2020-05-26  4302                                 
  new_state, &ucmd, &resp, udata);
50aec2c3135efd Leon Romanovsky 2020-05-26  4303  
50aec2c3135efd Leon Romanovsky 2020-05-26  4304         /* resp.response_length 
is set in ECE supported flows only */
50aec2c3135efd Leon Romanovsky 2020-05-26  4305         if (!err && 
resp.response_length &&
50aec2c3135efd Leon Romanovsky 2020-05-26 @4306             udata->outlen >= 
resp.response_length)
50aec2c3135efd Leon Romanovsky 2020-05-26  4307                 /*
50aec2c3135efd Leon Romanovsky 2020-05-26  4308                  * We don't 
check return value of the function below
50aec2c3135efd Leon Romanovsky 2020-05-26  4309                  * on purpose, 
because it is unclear how to unwind the
50aec2c3135efd Leon Romanovsky 2020-05-26  4310                  * error flow 
after QP was modified to the new state.
50aec2c3135efd Leon Romanovsky 2020-05-26  4311                  */
50aec2c3135efd Leon Romanovsky 2020-05-26  4312                 
ib_copy_to_udata(udata, &resp, resp.response_length);
e126ba97dba9ed Eli Cohen       2013-07-07  4313  
e126ba97dba9ed Eli Cohen       2013-07-07  4314  out:
e126ba97dba9ed Eli Cohen       2013-07-07  4315         
mutex_unlock(&qp->mutex);
e126ba97dba9ed Eli Cohen       2013-07-07  4316         return err;
e126ba97dba9ed Eli Cohen       2013-07-07  4317  }
e126ba97dba9ed Eli Cohen       2013-07-07  4318  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to