From patchwork Wed Aug 22 14:51:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Potnuri Bharat Teja X-Patchwork-Id: 10573003 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A69FD921 for ; Wed, 22 Aug 2018 14:52:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9634628CEE for ; Wed, 22 Aug 2018 14:52:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 898F62A6A6; Wed, 22 Aug 2018 14:52:06 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 0313028CEE for ; Wed, 22 Aug 2018 14:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728975AbeHVSRR (ORCPT ); Wed, 22 Aug 2018 14:17:17 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:5957 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728732AbeHVSRR (ORCPT ); Wed, 22 Aug 2018 14:17:17 -0400 Received: from localhost (mehrangarh.blr.asicdesigners.com [10.193.185.169]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w7MEpvuo019197; Wed, 22 Aug 2018 07:51:59 -0700 From: Potnuri Bharat Teja To: jgg@ziepe.ca, dledford@redhat.com Cc: swise@opengridcomputing.com, rajur@chelsio.com, bharat@chelsio.com, linux-rdma@vger.kernel.org Subject: [PATCH] iw_cxgb4: fix uninitialized variable plen Date: Wed, 22 Aug 2018 20:21:49 +0530 Message-Id: <20180822145149.4697-1-bharat@chelsio.com> X-Mailer: git-send-email 2.18.0.232.gb7bd9486b055 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 Fixes the following smatch warning and few more possible cases: The patch 94245f4ad9e1: "iw_cxgb4: Support FW write completion WR" from Aug 2, 2018, leads to the following static checker warning: drivers/infiniband/hw/cxgb4/qp.c:651 build_rdma_write_cmpl() error: uninitialized symbol 'plen'. Fixes: 94245f4ad9e ("iw_cxgb4: Support FW write completion WR") Reported-by: Dan Carpenter Signed-off-by: Potnuri Bharat Teja --- drivers/infiniband/hw/cxgb4/qp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index b3203afa3b1d..c625d94db038 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -487,7 +487,7 @@ static int build_isgl(__be64 *queue_start, __be64 *queue_end, static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { - u32 plen; + u32 plen = 0; int size; int ret; @@ -519,7 +519,6 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, wqe->send.r3 = 0; wqe->send.r4 = 0; - plen = 0; if (wr->num_sge) { if (wr->send_flags & IB_SEND_INLINE) { ret = build_immd(sq, wqe->send.u.immd_src, wr, @@ -554,7 +553,7 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe, static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe, const struct ib_send_wr *wr, u8 *len16) { - u32 plen; + u32 plen = 0; int size; int ret; @@ -615,7 +614,7 @@ static void build_rdma_write_cmpl(struct t4_sq *sq, struct fw_ri_rdma_write_cmpl_wr *wcwr, const struct ib_send_wr *wr, u8 *len16) { - u32 plen; + u32 plen = 0; int size; /*