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: <55477BF7.2020102@linaro.org>
Date:	Mon, 04 May 2015 16:02:31 +0200
From:	Daniel Lezcano <daniel.lezcano@...aro.org>
To:	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Peter Zijlstra <peterz@...radead.org>
CC:	Linux PM list <linux-pm@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] cpuidle: Check the sign of index in cpuidle_reflect()

On 05/04/2015 03:57 PM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> Avoid calling the governor's ->reflect method if the state index
> passed to cpuidle_reflect() is negative.
>
> This allows the analogous check to be dropped from menu_reflect(),
> so do that too, and ensures that arbitrary error codes can be
> passed to cpuidle_reflect() as the index with no adverse
> consequences.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

Reviewed-by: Daniel Lezcano <daniel.lezcano@...aro.org>


> ---
>   drivers/cpuidle/cpuidle.c        |    2 +-
>   drivers/cpuidle/governors/menu.c |    4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> Index: linux-pm/drivers/cpuidle/cpuidle.c
> ===================================================================
> --- linux-pm.orig/drivers/cpuidle/cpuidle.c
> +++ linux-pm/drivers/cpuidle/cpuidle.c
> @@ -249,7 +249,7 @@ int cpuidle_enter(struct cpuidle_driver
>    */
>   void cpuidle_reflect(struct cpuidle_device *dev, int index)
>   {
> -	if (cpuidle_curr_governor->reflect)
> +	if (cpuidle_curr_governor->reflect && index >= 0)
>   		cpuidle_curr_governor->reflect(dev, index);
>   }
>
> Index: linux-pm/drivers/cpuidle/governors/menu.c
> ===================================================================
> --- linux-pm.orig/drivers/cpuidle/governors/menu.c
> +++ linux-pm/drivers/cpuidle/governors/menu.c
> @@ -367,9 +367,9 @@ static int menu_select(struct cpuidle_dr
>   static void menu_reflect(struct cpuidle_device *dev, int index)
>   {
>   	struct menu_device *data = this_cpu_ptr(&menu_devices);
> +
>   	data->last_state_idx = index;
> -	if (index >= 0)
> -		data->needs_update = 1;
> +	data->needs_update = 1;
>   }
>
>   /**
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ