[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54EB6E0A.30208@interlog.com>
Date: Mon, 23 Feb 2015 13:14:34 -0500
From: Douglas Gilbert <dgilbert@...erlog.com>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
"James E. J. Bottomley" <JBottomley@...allels.com>,
linux-scsi@...r.kernel.org
CC: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 2/3] SCSI-debug: Less function calls in scsi_debug_init()
after error detection
On 15-02-06 12:25 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Fri, 6 Feb 2015 17:48:34 +0100
>
> The vfree() function was called in two cases by the scsi_debug_init() function
> during error handling even if the passed variables "dif_storep" and
> "map_storep" contained null pointers eventually.
>
> This implementation detail could be improved by the introduction of two
> jump labels.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
Acked-by: Douglas Gilbert <dgilbert@...erlog.com>
> ---
> drivers/scsi/scsi_debug.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index 9e4add7..756b7be 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -4887,7 +4887,7 @@ static int __init scsi_debug_init(void)
> if (dif_storep == NULL) {
> pr_err("%s: out of mem. (DIX)\n", __func__);
> ret = -ENOMEM;
> - goto free_vm;
> + goto free_fake;
> }
>
> memset(dif_storep, 0xff, dif_size);
> @@ -4920,7 +4920,7 @@ static int __init scsi_debug_init(void)
> if (map_storep == NULL) {
> pr_err("%s: out of mem. (MAP)\n", __func__);
> ret = -ENOMEM;
> - goto free_vm;
> + goto free_dif;
> }
>
> bitmap_zero(map_storep, map_size);
> @@ -4934,7 +4934,7 @@ static int __init scsi_debug_init(void)
> if (IS_ERR(pseudo_primary)) {
> pr_warn("%s: root_device_register() error\n", __func__);
> ret = PTR_ERR(pseudo_primary);
> - goto free_vm;
> + goto free_map;
> }
> ret = bus_register(&pseudo_lld_bus);
> if (ret < 0) {
> @@ -4968,9 +4968,11 @@ bus_unreg:
> bus_unregister(&pseudo_lld_bus);
> dev_unreg:
> root_device_unregister(pseudo_primary);
> -free_vm:
> +free_map:
> vfree(map_storep);
> +free_dif:
> vfree(dif_storep);
> +free_fake:
> vfree(fake_storep);
> return ret;
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists