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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeS86iWKxTGVWmSgVcJ9cTgLWM7tDAmdonipB7pskJEHg@mail.gmail.com>
Date:	Fri, 22 Apr 2016 02:09:22 +0300
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	Giedrius Statkevičius 
	<giedrius.statkevicius@...il.com>
Cc:	Corentin Chary <corentin.chary@...il.com>,
	"dvhart@...radead.org" <dvhart@...radead.org>,
	acpi4asus-user@...ts.sourceforge.net,
	platform-driver-x86@...r.kernel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] asus-laptop: correct error handling in asus_read_brightness()

On Sat, Apr 16, 2016 at 3:27 AM, Giedrius Statkevičius
<giedrius.statkevicius@...il.com> wrote:
> It is possible that acpi_evaluate_integer might fail and value would not be
> set to any value so correct this defect by returning 0 in case of an
> error. This is also the correct thing to return because the backlight
> subsystem will print the old value of brightness in this case.
>
> Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@...il.com>
> ---
>  drivers/platform/x86/asus-laptop.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
> index 9a69734..15f1311 100644
> --- a/drivers/platform/x86/asus-laptop.c
> +++ b/drivers/platform/x86/asus-laptop.c
> @@ -775,8 +775,10 @@ static int asus_read_brightness(struct backlight_device *bd)
>
>         rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET,
>                                    NULL, &value);
> -       if (ACPI_FAILURE(rv))
> +       if (ACPI_FAILURE(rv)) {
>                 pr_warn("Error reading brightness\n");
> +               return 0;
> +       }

This looks like a workaround.
I suppose the real fix is to return here an error code and fix all callers, like
drivers/video/backlight/backlight.c.

>
>         return value;
>  }
> --
> 2.8.0
>



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ