From patchwork Wed Jul 27 19:17:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 9250357 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F79560E66 for ; Wed, 27 Jul 2016 19:18:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FFE325223 for ; Wed, 27 Jul 2016 19:18:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24A9526253; Wed, 27 Jul 2016 19:18:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEF432624C for ; Wed, 27 Jul 2016 19:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758559AbcG0TSp (ORCPT ); Wed, 27 Jul 2016 15:18:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42804 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758350AbcG0TRp (ORCPT ); Wed, 27 Jul 2016 15:17:45 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A34FB85364; Wed, 27 Jul 2016 19:17:44 +0000 (UTC) Received: from hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com (hp-dl360pgen8-07.khw.lab.eng.bos.redhat.com [10.16.184.47]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6RJHenv032006; Wed, 27 Jul 2016 15:17:44 -0400 From: Jarod Wilson To: linux-rdma@vger.kernel.org Cc: Jarod Wilson , Yishai Hadas Subject: [PATCH libmlx5 6/6] fix undefined uuar_index value assignment Date: Wed, 27 Jul 2016 15:17:27 -0400 Message-Id: <1469647047-7544-7-git-send-email-jarod@redhat.com> In-Reply-To: <1469647047-7544-1-git-send-email-jarod@redhat.com> References: <1469647047-7544-1-git-send-email-jarod@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 27 Jul 2016 19:17:44 +0000 (UTC) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the case of (attr->comp_mask & MLX5_CREATE_QP_EX2_COMP_MASK) being not true, uuar_index gets set to resp.uuar_index, but nothing ever initializes resp.uuar_index. That said, both this case, and the true case, it looks like uuar_index never gets assigned to anything but 0. In the true path, resp_ex gets memset to 0, and then nothing ever sets uuar_index. Not sure what the intended use was here, but ultimately, uuar_index is always going to be 0 with this patch (0 or undetermined garbage before). Additionally, I'm not sure if the cmd and resp size parameters passed to ibv_cmd_create_qp_ex() are correct, but they're at least larger than they might be, which should be fine. I think. But I'm just guessing here. CC: Yishai Hadas Signed-off-by: Jarod Wilson --- src/verbs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/verbs.c b/src/verbs.c index d64e406..e88253e 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -1235,12 +1235,14 @@ struct ibv_qp *create_qp(struct ibv_context *context, cmd.uidx = usr_idx; } - if (attr->comp_mask & MLX5_CREATE_QP_EX2_COMP_MASK) + if (attr->comp_mask & MLX5_CREATE_QP_EX2_COMP_MASK) { ret = mlx5_cmd_create_qp_ex(context, attr, &cmd, qp, &resp_ex); - else + } else { + memset(&resp, 0, sizeof(resp)); ret = ibv_cmd_create_qp_ex(context, &qp->verbs_qp, sizeof(qp->verbs_qp), attr, &cmd.ibv_cmd, sizeof(cmd), &resp.ibv_resp, sizeof(resp)); + } if (ret) { mlx5_dbg(fp, MLX5_DBG_QP, "ret %d\n", ret); goto err_free_uidx;