Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941133AbcLVQXT (ORCPT ); Thu, 22 Dec 2016 11:23:19 -0500 Received: from mail-by2nam01on0055.outbound.protection.outlook.com ([104.47.34.55]:45412 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750889AbcLVQXR (ORCPT ); Thu, 22 Dec 2016 11:23:17 -0500 X-Greylist: delayed 26252 seconds by postgrey-1.27 at vger.kernel.org; Thu, 22 Dec 2016 11:23:17 EST From: "Rangankar, Manish" To: Colin King , Dept-Eng QLogic Storage Upstream , "James E . J . Bottomley" , "Martin K . Petersen" , "linux-scsi@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] scsi: qedi: return via va_end to match corresponding va_start Thread-Topic: [PATCH] scsi: qedi: return via va_end to match corresponding va_start Thread-Index: AQHSV6ZLh0yofgdWzkaOU043R9DwNqEUDfsA Date: Thu, 22 Dec 2016 08:51:13 +0000 Message-ID: References: <20161216141043.22324-1-colin.king@canonical.com> In-Reply-To: <20161216141043.22324-1-colin.king@canonical.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Manish.Rangankar@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [114.143.185.87] x-ms-office365-filtering-correlation-id: eac6362a-e515-47cd-9f68-08d42a47af36 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN3PR07MB2483; x-microsoft-exchange-diagnostics: 1;BN3PR07MB2483;7:X1mJE9Hg9OO+EHANQiPEIdy6mMq818XOH/Z7XRrAmBdkrBsSFm/WCfM0WG1z3oibrPnyUovnEvMC3jYEY6+CrtVWy4C0F8yL9qFnC6GCTnq0778BeHrCh7F3ve8FktezLGjGenDvbq+LbcEzAudv9zeTKVQ08ihgcep7fsuQzqe7f/Z8t+QbTptj8iSEy7Pdo2oJXAYGUEyrX9JsYrtG8m7iuS1Glbqiqhqc+4knx3jtGoPJfW1UAgnyMg3JbksDBnJMTyy4qryuPZ8jsXfMA59Zz/ZHNeILn2Q++bfyC1S1RBDsUse7Ha8HAoDRkpw2kjAU+545sd4mnR1rOJ4LPM0GFNQWdM1myd49IrkPBcBye7eImUp+3gMJU52RldY2akm85gu8A+1GEAOlArPbzGhrV0tO8Zx8plMUMorpk8yBzu9+AdeFwOFCY45U+KtP41VLL6bEqBrOMIUmKGLz3A== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(20161123558021)(6072148);SRVR:BN3PR07MB2483;BCL:0;PCL:0;RULEID:;SRVR:BN3PR07MB2483; x-forefront-prvs: 01644DCF4A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39450400003)(24454002)(199003)(377454003)(189002)(5001770100001)(97736004)(189998001)(106116001)(4326007)(5660300001)(2950100002)(76176999)(50986999)(54356999)(3660700001)(3280700002)(92566002)(229853002)(81166006)(81156014)(105586002)(8936002)(2900100001)(8676002)(38730400001)(25786008)(2501003)(77096006)(106356001)(6512006)(6506006)(6486002)(6436002)(6116002)(102836003)(68736007)(99286002)(86362001)(7736002)(3846002)(305945005)(2906002)(36756003)(66066001)(122556002)(101416001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2483;H:BN3PR07MB2483.namprd07.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <1ABE2215FA17804E8A1E34DD65BB1F5C@namprd07.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Dec 2016 08:51:13.5238 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2483 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uBMGNOLU007635 Content-Length: 2293 Lines: 87 On 16/12/16 7:40 PM, "Colin King" wrote: >From: Colin Ian King > >Although on most systems va_end is a no-op, it is good practice >to use va_end on the function return path, especially since the >va_start documenation states: > > "Each invocation of va_start() must be matched by a corresponding > invocation of va_end() in the same function." > >Found with static analysis by CoverityScan, CIDs 1389477-1389479 > >Signed-off-by: Colin Ian King >--- > drivers/scsi/qedi/qedi_dbg.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/drivers/scsi/qedi/qedi_dbg.c b/drivers/scsi/qedi/qedi_dbg.c >index 2bdedb9..8fd28b0 100644 >--- a/drivers/scsi/qedi/qedi_dbg.c >+++ b/drivers/scsi/qedi/qedi_dbg.c >@@ -52,7 +52,7 @@ qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char >*func, u32 line, > vaf.va = &va; > > if (!(qedi_dbg_log & QEDI_LOG_WARN)) >- return; >+ goto ret; > > if (likely(qedi) && likely(qedi->pdev)) > pr_warn("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), >@@ -60,6 +60,7 @@ qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char >*func, u32 line, > else > pr_warn("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); > >+ret: > va_end(va); > } > >@@ -80,7 +81,7 @@ qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char >*func, u32 line, > vaf.va = &va; > > if (!(qedi_dbg_log & QEDI_LOG_NOTICE)) >- return; >+ goto ret; > > if (likely(qedi) && likely(qedi->pdev)) > pr_notice("[%s]:[%s:%d]:%d: %pV", >@@ -89,6 +90,7 @@ qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char >*func, u32 line, > else > pr_notice("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); > >+ret: > va_end(va); > } > >@@ -109,7 +111,7 @@ qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char >*func, u32 line, > vaf.va = &va; > > if (!(qedi_dbg_log & level)) >- return; >+ goto ret; > > if (likely(qedi) && likely(qedi->pdev)) > pr_info("[%s]:[%s:%d]:%d: %pV", dev_name(&qedi->pdev->dev), >@@ -117,6 +119,7 @@ qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char >*func, u32 line, > else > pr_info("[0000:00:00.0]:[%s:%d]: %pV", nfunc, line, &vaf); > >+ret: > va_end(va); > } > >-- >2.10.2 Acked-by: Manish Rangankar