lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOi1vP_ETMVvw5WhRM-Zbe8Aec+sXDJm2-W8+w3EZ-bccVzEnA@mail.gmail.com>
Date:   Tue, 13 Sep 2016 10:10:48 +0200
From:   Ilya Dryomov <idryomov@...il.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     Ceph Development <ceph-devel@...r.kernel.org>,
        Alex Elder <elder@...nel.org>, Sage Weil <sage@...hat.com>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 28/47] block-rbd: Refactor a jump target in rbd_img_obj_exists_submit()

On Mon, Sep 12, 2016 at 9:14 PM, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Mon, 12 Sep 2016 19:44:30 +0200
>
> Adjust a jump target so that a duplicate check can then be avoided
> at the end.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/block/rbd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 17bdc21..66801ec 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2920,7 +2920,7 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
>         stat_request = rbd_obj_request_create(obj_request->object_name, 0, 0,
>                                                         OBJ_REQUEST_PAGES);
>         if (!stat_request)
> -               goto out;
> +               goto put_request;
>
>         rbd_obj_request_get(obj_request);
>         stat_request->obj_request = obj_request;
> @@ -2932,7 +2932,7 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
>         stat_request->osd_req = rbd_osd_req_create(rbd_dev, OBJ_OP_READ, 1,
>                                                    stat_request);
>         if (!stat_request->osd_req)
> -               goto out;
> +               goto put_request;
>         stat_request->callback = rbd_img_obj_exists_callback;
>
>         osd_req_op_init(stat_request->osd_req, 0, CEPH_OSD_OP_STAT, 0);
> @@ -2942,8 +2942,8 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
>
>         osdc = &rbd_dev->rbd_client->client->osdc;
>         ret = rbd_obj_request_submit(osdc, stat_request);
> -out:
>         if (ret)
> + put_request:
>                 rbd_obj_request_put(obj_request);
>
>         return ret;
> --
> 2.10.0

Don't do this.  goto into an if block is rarely a good idea, more so
when you are attempting to micro-optimize a very cold error path.

Thanks,

                Ilya

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ