Date: Thu, 15 Feb 2018 09:04:06 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r329306 - in stable/11/sys: dev/mlx5/mlx5_ib ofed/drivers/infiniband/hw/mthca ofed/include/rdma Message-ID: <201802150904.w1F946Kb088754@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Thu Feb 15 09:04:06 2018 New Revision: 329306 URL: https://svnweb.freebsd.org/changeset/base/329306 Log: MFC r325807: Make sure the ib_wr_opcode enum is signed by adding a negative dummy element. Different compilers may optimise the enum type in different ways. This ensures coherency when range checking the value of enums in ibcore. Sponsored by: Mellanox Technologies Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c stable/11/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Feb 15 09:00:11 2018 (r329305) +++ stable/11/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Thu Feb 15 09:04:06 2018 (r329306) @@ -2497,7 +2497,7 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_se } for (nreq = 0; wr; nreq++, wr = wr->next) { - if (unlikely(wr->opcode >= ARRAY_SIZE(mlx5_ib_opcode))) { + if (unlikely(wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mlx5_ib_opcode))) { mlx5_ib_warn(dev, "Invalid opcode 0x%x\n", wr->opcode); err = -EINVAL; *bad_wr = wr; Modified: stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c Thu Feb 15 09:00:11 2018 (r329305) +++ stable/11/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c Thu Feb 15 09:04:06 2018 (r329306) @@ -1765,7 +1765,7 @@ int mthca_tavor_post_send(struct ib_qp *ibqp, struct i qp->wrid[ind] = wr->wr_id; - if (wr->opcode >= ARRAY_SIZE(mthca_opcode)) { + if (wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mthca_opcode)) { mthca_err(dev, "opcode invalid\n"); err = -EINVAL; *bad_wr = wr; Modified: stable/11/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Feb 15 09:00:11 2018 (r329305) +++ stable/11/sys/ofed/include/rdma/ib_verbs.h Thu Feb 15 09:04:06 2018 (r329306) @@ -1136,6 +1136,8 @@ enum ib_wr_opcode { IB_WR_RESERVED8, IB_WR_RESERVED9, IB_WR_RESERVED10, + + IB_WR_DUMMY = -1, /* force enum type signed */ }; enum ib_send_flags {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802150904.w1F946Kb088754>