mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
RDMA: Use ib_is_udata_in_empty() for places calling ib_is_udata_cleared()
Convert the pattern: if (udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen)) Using Coccinelle: virtual patch virtual context virtual report @@ expression udata; @@ ( - udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen) + !ib_is_udata_in_empty(udata) | - udata->inlen > 0 && !ib_is_udata_cleared(udata, 0, udata->inlen) + !ib_is_udata_in_empty(udata) ) @@ expression udata; @@ - udata && udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen) + !ib_is_udata_in_empty(udata) These cases are already checking for zeroed data that the kernel does not understand. Run another pass with AI to propagate the return code correctly and remove redundant prints. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
cd31340419
commit
55e6360d8f
|
|
@ -218,12 +218,9 @@ int efa_query_device(struct ib_device *ibdev,
|
|||
struct efa_dev *dev = to_edev(ibdev);
|
||||
int err;
|
||||
|
||||
if (udata && udata->inlen &&
|
||||
!ib_is_udata_cleared(udata, 0, udata->inlen)) {
|
||||
ibdev_dbg(ibdev,
|
||||
"Incompatible ABI params, udata not cleared\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = ib_is_udata_in_empty(udata);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
dev_attr = &dev->dev_attr;
|
||||
|
||||
|
|
@ -433,13 +430,9 @@ int efa_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
|
|||
struct efa_pd *pd = to_epd(ibpd);
|
||||
int err;
|
||||
|
||||
if (udata->inlen &&
|
||||
!ib_is_udata_cleared(udata, 0, udata->inlen)) {
|
||||
ibdev_dbg(&dev->ibdev,
|
||||
"Incompatible ABI params, udata not cleared\n");
|
||||
err = -EINVAL;
|
||||
err = ib_is_udata_in_empty(udata);
|
||||
if (err)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
err = efa_com_alloc_pd(&dev->edev, &result);
|
||||
if (err)
|
||||
|
|
@ -982,12 +975,9 @@ int efa_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
|
|||
if (qp_attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (udata->inlen &&
|
||||
!ib_is_udata_cleared(udata, 0, udata->inlen)) {
|
||||
ibdev_dbg(&dev->ibdev,
|
||||
"Incompatible ABI params, udata not cleared\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = ib_is_udata_in_empty(udata);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
cur_state = qp_attr_mask & IB_QP_CUR_STATE ? qp_attr->cur_qp_state :
|
||||
qp->state;
|
||||
|
|
@ -1612,13 +1602,11 @@ static struct efa_mr *efa_alloc_mr(struct ib_pd *ibpd, int access_flags,
|
|||
struct efa_dev *dev = to_edev(ibpd->device);
|
||||
int supp_access_flags;
|
||||
struct efa_mr *mr;
|
||||
int ret;
|
||||
|
||||
if (udata && udata->inlen &&
|
||||
!ib_is_udata_cleared(udata, 0, udata->inlen)) {
|
||||
ibdev_dbg(&dev->ibdev,
|
||||
"Incompatible ABI params, udata not cleared\n");
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
ret = ib_is_udata_in_empty(udata);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
supp_access_flags =
|
||||
IB_ACCESS_LOCAL_WRITE |
|
||||
|
|
@ -2082,12 +2070,9 @@ int efa_create_ah(struct ib_ah *ibah,
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
if (udata->inlen &&
|
||||
!ib_is_udata_cleared(udata, 0, udata->inlen)) {
|
||||
ibdev_dbg(&dev->ibdev, "Incompatible ABI params\n");
|
||||
err = -EINVAL;
|
||||
err = ib_is_udata_in_empty(udata);
|
||||
if (err)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
memcpy(params.dest_addr, ah_attr->grh.dgid.raw,
|
||||
sizeof(params.dest_addr));
|
||||
|
|
|
|||
|
|
@ -1696,9 +1696,9 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
|
|||
(flow_attr->type != IB_FLOW_ATTR_NORMAL))
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
|
||||
if (udata &&
|
||||
udata->inlen && !ib_is_udata_cleared(udata, 0, udata->inlen))
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
err = ib_is_udata_in_empty(udata);
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
|
||||
memset(type, 0, sizeof(type));
|
||||
|
||||
|
|
|
|||
|
|
@ -4297,10 +4297,9 @@ int mlx4_ib_create_rwq_ind_table(struct ib_rwq_ind_table *rwq_ind_table,
|
|||
size_t min_resp_len;
|
||||
int i, err = 0;
|
||||
|
||||
if (udata->inlen > 0 &&
|
||||
!ib_is_udata_cleared(udata, 0,
|
||||
udata->inlen))
|
||||
return -EOPNOTSUPP;
|
||||
err = ib_is_udata_in_empty(udata);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
min_resp_len = offsetof(typeof(resp), reserved) + sizeof(resp.reserved);
|
||||
if (udata->outlen && udata->outlen < min_resp_len)
|
||||
|
|
|
|||
|
|
@ -965,8 +965,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
|
|||
|
||||
resp.response_length = resp_len;
|
||||
|
||||
if (uhw && uhw->inlen && !ib_is_udata_cleared(uhw, 0, uhw->inlen))
|
||||
return -EINVAL;
|
||||
err = ib_is_udata_in_empty(uhw);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
memset(props, 0, sizeof(*props));
|
||||
err = mlx5_query_system_image_guid(ibdev,
|
||||
|
|
|
|||
|
|
@ -5529,10 +5529,9 @@ int mlx5_ib_create_rwq_ind_table(struct ib_rwq_ind_table *ib_rwq_ind_table,
|
|||
u32 *in;
|
||||
void *rqtc;
|
||||
|
||||
if (udata->inlen > 0 &&
|
||||
!ib_is_udata_cleared(udata, 0,
|
||||
udata->inlen))
|
||||
return -EOPNOTSUPP;
|
||||
err = ib_is_udata_in_empty(udata);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (init_attr->log_ind_tbl_size >
|
||||
MLX5_CAP_GEN(dev->mdev, log_max_rqt_size)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user