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: 9233375 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 336A360865 for ; Sat, 16 Jul 2016 20:24:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23D08205AB for ; Sat, 16 Jul 2016 20:24:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 183AF209CC; Sat, 16 Jul 2016 20:24:35 +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 B4B23205AB for ; Sat, 16 Jul 2016 20:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751918AbcGPUYK (ORCPT ); Sat, 16 Jul 2016 16:24:10 -0400 Received: from mout.web.de ([212.227.17.12]:55623 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbcGPUYI (ORCPT ); Sat, 16 Jul 2016 16:24:08 -0400 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 Subject: [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection 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> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall 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 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org 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); }