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: <CAHp75VcMkXCioCzmLE0+BTmkqc5RSOx9yPO0ectVHMrMvewgwg@mail.gmail.com>
Date:   Tue, 31 Oct 2017 15:33:18 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     Platform Driver <platform-driver-x86@...r.kernel.org>,
        Andy Shevchenko <andy@...radead.org>,
        Darren Hart <dvhart@...radead.org>,
        Mattia Dongili <malattia@...ux.it>,
        LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] Sony-laptop: Use common error handling code in sony_nc_setup_rfkill()

On Mon, Oct 30, 2017 at 10:15 PM, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Mon, 30 Oct 2017 21:10:49 +0100
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.

Apparently this patch done without reading the actual code.

NAK.

-1 is EPERM which sounds wrong here. If you would like to fix it,
propagate a real error codes from sony_call_snc_handle().

>         if (!rfk)
>                 return -ENOMEM;

Okay error code.

>
> -       if (sony_call_snc_handle(sony_rfkill_handle, 0x200, &result) < 0) {
> -               rfkill_destroy(rfk);
> -               return -1;

Not okay.

> -       }
> +       if (sony_call_snc_handle(sony_rfkill_handle, 0x200, &result) < 0)
> +               goto destroy_rfk;
> +
>         hwblock = !(result & 0x1);
>
>         if (sony_call_snc_handle(sony_rfkill_handle,
> -                               sony_rfkill_address[nc_type],
> -                               &result) < 0) {
> -               rfkill_destroy(rfk);
> -               return -1;

Not okay and it might be different from previous case.

> -       }
> +                                sony_rfkill_address[nc_type],
> +                                &result) < 0)
> +               goto destroy_rfk;
> +
>         swblock = !(result & 0x2);
>
>         rfkill_init_sw_state(rfk, swblock);
> @@ -1684,6 +1682,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
>         }
>         sony_rfkill_devices[nc_type] = rfk;
>         return err;
> +
> +destroy_rfk:
> +       rfkill_destroy(rfk);
> +       return -1;

P.S. Don't bother us with patches on which you didn't do your home work.
Thanks for understanding.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ