From patchwork Sat Jul 16 20:23:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9233383 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 5654D60865 for ; Sat, 16 Jul 2016 20:26:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47734212D8 for ; Sat, 16 Jul 2016 20:26:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BD1C212DB; Sat, 16 Jul 2016 20:26:13 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C7024212D8 for ; Sat, 16 Jul 2016 20:26:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bOW7y-0007su-5S; Sat, 16 Jul 2016 20:23:58 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bOW7x-0007so-E1 for xen-devel@lists.xenproject.org; Sat, 16 Jul 2016 20:23:57 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id D9/4D-12460-CD79A875; Sat, 16 Jul 2016 20:23:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRWlGSWpSXmKPExsVy5bEgj+6d6V3 hBot+clp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlLDr5hL/jGXdG3OqaBcTZXFyMXh5DAfEaJ X7372boYOTmEBXIkTkx4yAySEBE4zSix+8NjZoiqP2wSW5cdZwKpYhbIk5h74Bk7iM0mYC7Ru /YzC4jNK+Ah0fH9L5DNwcEioCpx7WoQSFhUIFRixZsTbBAlghInZz4BK+cU8JSYe+cBI8RIdY k/8y4xQ9jyEtvfzgHbKyHwmVFi56mNUE4fu8ThX28ZJzDyz0IybBaSAbOQDFjAyLyKUb04tag stUjXUi+pKDM9oyQ3MTNH19DAVC83tbg4MT01JzGpWC85P3cTIzAQGYBgB+PaVudDjJIcTEqi vN+PdoYL8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuDdMK0rXEiwKDU9tSItMwcYEzBpCQ4eJRHet SBp3uKCxNzizHSI1ClGRSlx3kkgCQGQREZpHlwbLA4vMcpKCfMyAh0ixFOQWpSbWYIq/4pRnI NRSZh3J8gUnsy8Erjpr4AWMwEttjZvB1lckoiQkmpgrElZOmllQt7jh9MDxXdpi+Tfmdnhpnu sKiohro3xyzudffZLNcxqlnjM4FR8vHpp8Nyn9pOaYg+4uGiecOgQ8yhesn/CJU2niPPc9RJy UbPXXmA4ME/rypan0zWfcE4/ttyE9WqCr9LBwKTfqi+uiFexXnn3583xnrhT+yS0txRVJ2/qL ZJ5qMRSnJFoqMVcVJwIABN5/va+AgAA X-Env-Sender: elfring@users.sourceforge.net X-Msg-Ref: server-3.tower-206.messagelabs.com!1468700635!46316485!1 X-Originating-IP: [212.227.17.12] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: QmFkIElQOiAyMTIuMjI3LjE3LjEyID0+IDEzODM5\n,sa_preprocessor: QmFkIElQOiAyMTIuMjI3LjE3LjEyID0+IDEzODM5\n X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48576 invoked from network); 16 Jul 2016 20:23:56 -0000 Received: from mout.web.de (HELO mout.web.de) (212.227.17.12) by server-3.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 16 Jul 2016 20:23:56 -0000 Received: from [192.168.1.2] ([77.182.189.163]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LaTeV-1awdpo2IpT-00mNtr; Sat, 16 Jul 2016 22:23:51 +0200 To: xen-devel@lists.xenproject.org, linux-scsi@vger.kernel.org, =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= , David Vrabel , Boris Ostrovsky References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <59e51c7d-f7bb-c55f-d2fe-06dccfef6a99@users.sourceforge.net> From: SF Markus Elfring Message-ID: <87e55a72-71ad-d0a1-b936-12565bbc6508@users.sourceforge.net> Date: Sat, 16 Jul 2016 22:23:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <59e51c7d-f7bb-c55f-d2fe-06dccfef6a99@users.sourceforge.net> X-Provags-ID: V03:K0:2K1ucctkOnVrXckv2xcZM9beNOmd4Qppg9p2KP5kSppu6kaJ5MJ StQH7x/gG8lP55TTqU//gMnIYwF3M1epGG3zb/DWjXHOFJzd6ZfOOmVJFsPkXYXNQajtB7D 9ftLZg/n+REhr80o14U0xN9XjFZsfgFh8y+WX5j1UN62/JgS4VekJ2YVsrUm05zbbpW828t 9mbtAZ+sIx4SGYpgRh6NQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:D5nvHwc7Cto=:QSqYZytju13hU0DPmQQa/J pq59amwbllCltqTuxbDn+/IYIgXmig+lXEBTN5LflOj7Ng9xkSJrXVO7gPr8vw6TiosH8/bse n6TKj22sb2vGQk0HXCANZShENSs2hXU0hqO4pi2a/r/TuJqnWll6676M8nRyuPWZAtOy2uf+U STNfHEK974mbjO6ar+me7uxvpX/moAK6+jKJ4TXf0NVbWInmglSEKxvkCSfr2fuoj4lsKrYnc yWuH6Y6jrjVhWGzgvpCl9G3WFFgwjznl9TPErSgAFPBkU/zZw1x7Uy/ZDmI97+cjk1UH4gkPP 9t0vxiMKQiFlixQfS5CQRiFYIc7LrvsTfSXwhYCn7mVeY5C0p2VQ/I2YcwaBj0HzG3boeRZEA eJOChT/pHS/4zekoMVsPt+YRU3pkwqqdELbY15EX0lPLXI0r6gnEzSfhsRuB2ePNsNY189EOs ix9DBLYgD7baidPvLSAyMGdQvKegM9jACv5UkFgOaJEAW2NhCHkhEWAiRQoNnGRz22A3MUBRV DB95ffpJEkbw+ErMEmZwUW3UfWwsxWd4dieiu54lcF4a25IeqnaAutqRP2rJbryxt3HfjD1CW NAFqZgU6QfufEdtZeMbAueRFOGTghZ/KTd0ObHgANUB0fJF7ogJZZJ8AnM1zFN9jhpa5pyTio VouCujYgXu4n1JWmqyj2c2U4eccYpXsFc4Cf1vys+sPHn8yeRdqCBiLHYu4b1u9F7bJMUhyb9 c8kxuHdsFPhoTo6BDhtgToXtOQFRHPK4JvAM4C0NQ3MEMkxG8qAk3Kock4YVVBX3kxM/aF2UQ ZcBtiZm Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Subject: [Xen-devel] [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 16 Jul 2016 21:42:42 +0200 The kfree() function was called in one case by the scsiback_device_action() function during error handling even if the passed variable "tmr" contained a null pointer. Adjust jump targets according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/xen/xen-scsiback.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 4a48c06..7612bc9 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -606,7 +606,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL); if (!tmr) { target_put_sess_cmd(se_cmd); - goto err; + goto do_resp; } init_waitqueue_head(&tmr->tmr_wait); @@ -616,7 +616,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, unpacked_lun, tmr, act, GFP_KERNEL, tag, TARGET_SCF_ACK_KREF); if (rc) - goto err; + goto free_tmr; wait_event(tmr->tmr_wait, atomic_read(&tmr->tmr_complete)); @@ -626,8 +626,9 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, scsiback_do_resp_with_sense(NULL, err, 0, pending_req); transport_generic_free_cmd(&pending_req->se_cmd, 1); return; -err: +free_tmr: kfree(tmr); +do_resp: scsiback_do_resp_with_sense(NULL, err, 0, pending_req); }