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-next>] [day] [month] [year] [list]
Date:	Fri,  7 Feb 2014 13:55:53 -0500
From:	Prarit Bhargava <prarit@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Prarit Bhargava <prarit@...hat.com>,
	Dominik Brodowski <linux@...inikbrodowski.net>,
	Thomas Renninger <trenn@...e.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Alan Cox <alan@...ux.intel.com>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Subject: [PATCH] tools, cpupower Fix error condition in cmd_freq_set()

On a system which has only 4.00GHz set as the only available frequency,

[root@...-pike-05 ~]# cpupower frequency-info
<snip>
  current policy: frequency should be within 4.00 GHz and 4.00 GHz.
                  The governor "userspace" may decide which speed to use
                  within this range.
<snip>

setting the frequency to 2.8GHz does not return an error.

[root@...-pike-05 ~]# cpupower frequency-set --freq 2800MHz
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
[root@...-pike-05 ~]#

The frequency set error should stop with an error message after the first
failure.  Fix the error return in cmd_freq_set() to read errors as less
than zero.

Signed-off-by: Prarit Bhargava <prarit@...hat.com>
Cc: Dominik Brodowski <linux@...inikbrodowski.net>
Cc: Thomas Renninger <trenn@...e.de>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Cc: Alan Cox <alan@...ux.intel.com>
Cc: One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
---
 tools/power/cpupower/utils/cpufreq-set.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index a416de8..e5f78623 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -320,7 +320,7 @@ int cmd_freq_set(int argc, char **argv)
 
 		printf(_("Setting cpu: %d\n"), cpu);
 		ret = do_one_cpu(cpu, &new_pol, freq, policychange);
-		if (ret)
+		if (ret < 0)
 			break;
 	}
 
-- 
1.7.9.3

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