Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8288839ybi; Thu, 6 Jun 2019 09:39:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKE9DStlqEOk96l0j8PZOHjEo9Cf9Kg5PPnexf0bGu8ZyGSUl5y1qWiTHlpepXcjzfMKXw X-Received: by 2002:a63:231c:: with SMTP id j28mr4088932pgj.430.1559839173341; Thu, 06 Jun 2019 09:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559839173; cv=none; d=google.com; s=arc-20160816; b=lfqMop5PJO4eVAHPvmsLfeQC5GwteMXAbpDjkipkIMdy1TV2+h9tmomu+IIDY0Qj79 Ma06IcGR3wc8Eq1FueECRlDVL5S9ejhP0uVwQu2TTvQbOVtSSud4E2wX6rO9lXI92tOP XGZgN57tFdHEYDdnPgULo1jhHUeQsOna2c8SM6RWWgz/rzW4jxETm42iSR1/tbO06lMO ai4ciK5h1GWvk37jgGEVqmv30xC1UNNsBP7cjbzGA7y9nqFriJCO/W6GE4367pw6ggEk fyhKZtxqYo3Dq1JJ+sG+ZEs/s6ft31o+8KsS5gmSuYboAquRnW/WeDpIXpAnMACSMSVh sltQ== 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; bh=duqKhL39aXCtdc9DxpUkHvrN6Mzu8hFP9iRMLcbjxms=; b=lvpKK/B61Zxhm6dMuJiyORYrvwML9UUe5v4ku211skU+/AoMwD47oWIahTQaAxUTCd zKhmuj2U+nxEdfi0Y0jFjo0Ya+7QKeMyBKlIFv/0wINsXzTD2WGprgym5n2cR6uILdRN 5wrExMqC6VkGE8HC9Fl2VpuAkIGTSXTLXQF/aCPA+hxBCH/1tuS/uwP2/4UflTY2a6uK 75js8nHf+d4Az7g6WigukmZ0bPD6VUry0lCSTLpkQ/W3RaR5WiQ0qF/e8Dvj8bHjU2Od 6/OolEzpKFE5RyP0mWr3fTmWvbVOM9Pma3LwvsvQqzqUXBdr81eAMPZb8P9q5HvtLksF r82g== ARC-Authentication-Results: i=1; mx.google.com; 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 p188si2415708pfp.112.2019.06.06.09.39.16; Thu, 06 Jun 2019 09:39:33 -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; 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 S1728077AbfFFMx0 (ORCPT + 99 others); Thu, 6 Jun 2019 08:53:26 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:50137 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfFFMx0 (ORCPT ); Thu, 6 Jun 2019 08:53:26 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id E1AF980262; Thu, 6 Jun 2019 14:53:13 +0200 (CEST) Date: Thu, 6 Jun 2019 14:53:23 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Arnd Bergmann , James Smart , "Martin K. Petersen" , Sasha Levin Subject: Re: [PATCH 4.19 237/276] scsi: lpfc: avoid uninitialized variable warning Message-ID: <20190606125323.GC27432@amd> References: <20190530030523.133519668@linuxfoundation.org> <20190530030539.944220603@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="adJ1OR3c6QgCpb/j" Content-Disposition: inline In-Reply-To: <20190530030539.944220603@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --adJ1OR3c6QgCpb/j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > [ Upstream commit faf5a744f4f8d76e7c03912b5cd381ac8045f6ec ] >=20 > clang -Wuninitialized incorrectly sees a variable being used without > initialization: >=20 > drivers/scsi/lpfc/lpfc_nvme.c:2102:37: error: variable 'localport' is uni= nitialized when used here > [-Werror,-Wuninitialized] > lport =3D (struct lpfc_nvme_lport *)localport->private; > ^~~~~~~~~ > drivers/scsi/lpfc/lpfc_nvme.c:2059:38: note: initialize the variable 'loc= alport' to silence this warning > struct nvme_fc_local_port *localport; > ^ > =3D NULL > 1 error generated. >=20 > This is clearly in dead code, as the condition leading up to it is always > false when CONFIG_NVME_FC is disabled, and the variable is always > initialized when nvme_fc_register_localport() got called successfully. >=20 > Change the preprocessor conditional to the equivalent C construct, which > makes the code more readable and gets rid of the warning. Unfortunately, this missed "else" branch where the code was freeing the memory with kfree(cstat)... so this introduces a memory leak. Best regards, Pavel > Signed-off-by: Arnd Bergmann > Acked-by: James Smart > Signed-off-by: Martin K. Petersen > Signed-off-by: Sasha Levin --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --adJ1OR3c6QgCpb/j Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlz5DMMACgkQMOfwapXb+vL9mgCfWykgy5M4WHThY/CXqMxs9B8y 7BcAnikxGH2w2GgBe5Ox/uWDPPO4yA9q =n/8A -----END PGP SIGNATURE----- --adJ1OR3c6QgCpb/j--