Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9485852ybi; Wed, 10 Jul 2019 11:07:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxEDLXIiIxEhWzbo6dpQLPaN5aD9at1hn9wYOtQ4qbaQYQr0FSVas631nzlAwBo3ceDGen X-Received: by 2002:a17:90a:8d0c:: with SMTP id c12mr8129311pjo.140.1562782039012; Wed, 10 Jul 2019 11:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562782039; cv=none; d=google.com; s=arc-20160816; b=vvptBtO3suf4dO+iqAGbTKmw7LWYp9ZK174KtpRRWviZTufJHLZfrH/JKjOImXIFoH o0I4YGK7mrRAmLOora7xLBsIRUVOibW4jRLWPyywAODZ1mSvXR10uh2EZllBIq65b9GO DrL46lBXR+9dn74/m1bywzhutT200FwbOSEUaXqTLvkJnpFSbSIrq8BiWVocHjRFpgDI dzTuGnwVX+QBvQbdOy81LL1fOc5JED6SIQsIBXcoC/OQYC0aX4KQnuLQ5Kw69mX9Q/pR smq+PfnpkKEDBn5S+N9btpiLF4GR0WWb4iTVvglSh51YlIGP1ckbxBzLbpULHtR14PXM FGSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UWdZTbRnsOfkrH/gcvFB0nmiNziCHTNBkuYxVNvSC3M=; b=uqSNhz1IxaCwfwOvm99/HQwtOEwNUMXmc2MNQ5ikMi/5pR8Ao6OyU2oAYfnFCkMWBo 2CVhmi5D1vZz5J+HsQBW/Ffm+ckUjlzMnQX5WHrDraFUwMYgFFZgPuz18Cpxy7SyVbL3 AxD+1Et3DoQqrjXelNvvLRAMaeTGhu7ZBkUF2lwe4wkqggvJhK6vPA/12QZT8AsQpDnR r3WIfsp5DwPqnnMGRcpBPDg5zH0/09tKM/njl/VUdAojTraxYpikP4YqEslZpSRkhdPY +heBsobwGT3e3CggkY274uJ/X30u6Aea/l4BxK/k+xTfD5rDxafsXVfM+9qiaxtPx/1z 1/mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="KFJ/rKJQ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z13si2907881pfr.86.2019.07.10.11.07.02; Wed, 10 Jul 2019 11:07:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="KFJ/rKJQ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727990AbfGJRCT (ORCPT + 99 others); Wed, 10 Jul 2019 13:02:19 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:35419 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbfGJRCT (ORCPT ); Wed, 10 Jul 2019 13:02:19 -0400 Received: by mail-qk1-f195.google.com with SMTP id r21so2481470qke.2 for ; Wed, 10 Jul 2019 10:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UWdZTbRnsOfkrH/gcvFB0nmiNziCHTNBkuYxVNvSC3M=; b=KFJ/rKJQwuFx0QxloQPg04YGFgrbogfNGTtlA0hv0mx17Fgjb0tQzdyrvEOK6kRqVz 7V+L2vZL5axYHxpKV6n8NETnuOFvx37FqA1KdIe6t63DBxAo22WEW+NpazyKt4W7PU/F YZzlSjdDYOdL3qw4wSMRS05iRP/9F4VmlH4tG7RF5aVEXY+YbdicYqx3DAno8CHzgENV SYKHLnQgX6VR0QBtv7MzB0XcgF6wjcJGjL9NZuoMmbuz/5xH8ETaL64soSZk1BSbyJjw nJGUnB+cpnt2ly4hneJjgHp1qcMCq54f6L/fSPsxE+Z6xDxHcFLHJvjgE17iWIeMLTi3 TQBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UWdZTbRnsOfkrH/gcvFB0nmiNziCHTNBkuYxVNvSC3M=; b=RxOkLYlpopWDurhfmoNWBHcjKVvpGXl++SkWzh9UV3Ff4ToFJ2ghoTAZFM1rZrLZCu BOYJ1yZCvfFcxM2hThC0Ro3xbrfFvmVjyy0JVkFP++6re1Ud4V9U1Vhy/h8SO59S4yEs yJH5/t1jh6hXupThzdTImUCDwtzG/yiqb4db4BAOaLPErbm22NvUl122m7+ObB7SkgPV Nb1gpLNph6ar7dMeXdkfDeRz8jYlH92Kg+zDu9Y/xITB9kLfz56J4jQCoH13bi8LksCe qAcwDX7cxd488+Kh59PA4l5ENw3f0bl42STi8aXK4LEAg3kAZXFHx3/zJgpCeJgT+//O 8c+g== X-Gm-Message-State: APjAAAUiMfn1nnz21At5VSJeFGVSr2gJB2w5CRJ8RcqQX3DVI7BzQhv+ 8M8laSccBjYhqQQi4WNbxhPchA== X-Received: by 2002:a37:a343:: with SMTP id m64mr24438145qke.75.1562778138173; Wed, 10 Jul 2019 10:02:18 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id r205sm1587546qke.115.2019.07.10.10.02.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Jul 2019 10:02:17 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hlFyy-0003xQ-Ve; Wed, 10 Jul 2019 14:02:16 -0300 Date: Wed, 10 Jul 2019 14:02:16 -0300 From: Jason Gunthorpe To: Nathan Chancellor , Mike Marciniszyn Cc: Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Kamenee Arumugam , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nick Desaulniers Subject: Re: [PATCH v2] IB/rdmavt: Fix variable shadowing issue in rvt_create_cq Message-ID: <20190710170216.GA15103@ziepe.ca> References: <20190709221312.7089-1-natechancellor@gmail.com> <20190709230552.61842-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190709230552.61842-1-natechancellor@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 09, 2019 at 04:05:53PM -0700, Nathan Chancellor wrote: > clang warns: > > drivers/infiniband/sw/rdmavt/cq.c:260:7: warning: variable 'err' is used > uninitialized whenever 'if' condition is true > [-Wsometimes-uninitialized] > if (err) > ^~~ > drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs > here > return err; > ^~~ > drivers/infiniband/sw/rdmavt/cq.c:260:3: note: remove the 'if' if its > condition is always false > if (err) > ^~~~~~~~ > drivers/infiniband/sw/rdmavt/cq.c:253:7: warning: variable 'err' is used > uninitialized whenever 'if' condition is true > [-Wsometimes-uninitialized] > if (!cq->ip) { > ^~~~~~~ > drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs > here > return err; > ^~~ > drivers/infiniband/sw/rdmavt/cq.c:253:3: note: remove the 'if' if its > condition is always false > if (!cq->ip) { > ^~~~~~~~~~~~~~ > drivers/infiniband/sw/rdmavt/cq.c:211:9: note: initialize the variable > 'err' to silence this warning > int err; > ^ > = 0 > 2 warnings generated. > > The function scoped err variable is uninitialized when the flow jumps > into the if statement. The if scoped err variable shadows the function > scoped err variable, preventing the err assignments within the if > statement to be reflected at the function level, which will cause > uninitialized use when the goto statements are taken. > > Just remove the if scoped err declaration so that there is only one > copy of the err variable for this function. > > Fixes: 239b0e52d8aa ("IB/hfi1: Move rvt_cq_wc struct into uapi directory") > Link: https://github.com/ClangBuiltLinux/linux/issues/594 > Reviewed-by: Nick Desaulniers > Signed-off-by: Nathan Chancellor Applied to for-next with Mike's ack Thanks, Jason