From patchwork Thu Nov 16 10:26:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10060937 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 37B5A60230 for ; Thu, 16 Nov 2017 10:26:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 314882A94A for ; Thu, 16 Nov 2017 10:26:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 237342A95C; Thu, 16 Nov 2017 10:26:15 +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 A30542A94A for ; Thu, 16 Nov 2017 10:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752144AbdKPK0L (ORCPT ); Thu, 16 Nov 2017 05:26:11 -0500 Received: from baptiste.telenet-ops.be ([195.130.132.51]:58048 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759626AbdKPK0I (ORCPT ); Thu, 16 Nov 2017 05:26:08 -0500 Received: from ayla.of.borg ([84.195.106.246]) by baptiste.telenet-ops.be with bizsmtp id aaS51w00h5JzmfG01aS5N8; Thu, 16 Nov 2017 11:26:06 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1eFHMz-0001hj-H9; Thu, 16 Nov 2017 11:26:05 +0100 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1eFHMz-0002tj-Eh; Thu, 16 Nov 2017 11:26:05 +0100 From: Geert Uytterhoeven To: Tatyana Nikolova , Roland Dreier , Doug Ledford Cc: Arnd Bergmann , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC] RDMA/iwpm: Fix uninitialized error code in iwpm_send_mapinfo() Date: Thu, 16 Nov 2017 11:26:04 +0100 Message-Id: <1510827964-11100-1-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 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 With gcc-4.1.2: drivers/infiniband/core/iwpm_util.c: In function ‘iwpm_send_mapinfo’: drivers/infiniband/core/iwpm_util.c:647: warning: ‘ret’ may be used uninitialized in this function Indeed, if nl_client is not found in any of the scanned has buckets, ret will be used uninitialized. Preinitialize ret to zero to fix this. Fixes: 30dc5e63d6a5ad24 ("RDMA/core: Add support for iWARP Port Mapper user space service") Signed-off-by: Geert Uytterhoeven --- RFC as I have no idea if this can ever happen, and if yes, what's the correct behavior to handle it: - return 0, - return an error code, - don't send anything, - anything else? --- drivers/infiniband/core/iwpm_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c index 3c4faadb8cddd7fd..eb000b540495acd1 100644 --- a/drivers/infiniband/core/iwpm_util.c +++ b/drivers/infiniband/core/iwpm_util.c @@ -644,7 +644,7 @@ int iwpm_send_mapinfo(u8 nl_client, int iwpm_pid) int i = 0, nlmsg_bytes = 0; unsigned long flags; const char *err_str = ""; - int ret; + int ret = 0; skb = dev_alloc_skb(NLMSG_GOODSIZE); if (!skb) {