From owner-svn-src-head@freebsd.org Tue Nov 14 14:51:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49E85DC0F15; Tue, 14 Nov 2017 14:51:39 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0D231942; Tue, 14 Nov 2017 14:51:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAEEpcZE086816; Tue, 14 Nov 2017 14:51:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAEEpbxc086813; Tue, 14 Nov 2017 14:51:37 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201711141451.vAEEpbxc086813@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 14 Nov 2017 14:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325807 - in head/sys: dev/mlx5/mlx5_ib ofed/drivers/infiniband/hw/mthca ofed/include/rdma X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: dev/mlx5/mlx5_ib ofed/drivers/infiniband/hw/mthca ofed/include/rdma X-SVN-Commit-Revision: 325807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2017 14:51:39 -0000 Author: hselasky Date: Tue Nov 14 14:51:37 2017 New Revision: 325807 URL: https://svnweb.freebsd.org/changeset/base/325807 Log: 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 MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c head/sys/ofed/include/rdma/ib_verbs.h Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Nov 14 14:43:35 2017 (r325806) +++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Tue Nov 14 14:51:37 2017 (r325807) @@ -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: head/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c Tue Nov 14 14:43:35 2017 (r325806) +++ head/sys/ofed/drivers/infiniband/hw/mthca/mthca_qp.c Tue Nov 14 14:51:37 2017 (r325807) @@ -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: head/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- head/sys/ofed/include/rdma/ib_verbs.h Tue Nov 14 14:43:35 2017 (r325806) +++ head/sys/ofed/include/rdma/ib_verbs.h Tue Nov 14 14:51:37 2017 (r325807) @@ -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 {