From: Roland Dreier Date: Sat, 19 May 2007 15:51:58 +0000 (-0700) Subject: IB/mlx4: Fix check of opcode in mlx4_ib_post_send() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=59b0ed121297b57abb2352bdc8313959e7cb5635;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git IB/mlx4: Fix check of opcode in mlx4_ib_post_send() wr->opcode is invalid if it's >= ARRAY_SIZE(mlx4_ib_opcode), not just strictly >. This was spotted by the Coverity checker (CID 1643). Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index bd28af5753d1..5706f988e2ec 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c @@ -1238,7 +1238,7 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, */ wmb(); - if (wr->opcode < 0 || wr->opcode > ARRAY_SIZE(mlx4_ib_opcode)) { + if (wr->opcode < 0 || wr->opcode >= ARRAY_SIZE(mlx4_ib_opcode)) { err = -EINVAL; goto out; }