summaryrefslogtreecommitdiffstats
path: root/ltp-20150119-cpufreq-format-string.patch
diff options
context:
space:
mode:
Diffstat (limited to 'ltp-20150119-cpufreq-format-string.patch')
-rw-r--r--ltp-20150119-cpufreq-format-string.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/ltp-20150119-cpufreq-format-string.patch b/ltp-20150119-cpufreq-format-string.patch
new file mode 100644
index 0000000..40a9756
--- /dev/null
+++ b/ltp-20150119-cpufreq-format-string.patch
@@ -0,0 +1,42 @@
+From 7a84b96e7abe6251e217bd9c69a83230bda23bc5 Mon Sep 17 00:00:00 2001
+From: Ken Dreyer <kdreyer@redhat.com>
+Date: Mon, 26 Jan 2015 13:19:15 -0700
+Subject: [PATCH] device-drivers/cpufreq: use safe format string arg
+
+Prior to this commit, the cpufreq_boost test failed to build if
+-Werror=format-security was used. The compiler could not examine the
+contents of the cdrv array.
+
+Adjust the SAFE_FILE_PRINTF call so that the format string is a string
+literal.
+
+Fedora recently enabled this compiler option in their RPM builds, so
+this fixes the build on Fedora 21.
+
+Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
+---
+ testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
+index d1ba2cf..872b120 100644
+--- a/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
++++ b/testcases/kernel/device-drivers/cpufreq/cpufreq_boost.c
+@@ -152,12 +152,12 @@ static void test_run(void)
+
+ /* Enable boost */
+ if (boost_value == cdrv[id].off)
+- SAFE_FILE_PRINTF(cleanup, cdrv[id].file, cdrv[id].on_str);
++ SAFE_FILE_PRINTF(cleanup, cdrv[id].file, "%s", cdrv[id].on_str);
+ tst_resm(TINFO, "load CPU0 with boost enabled");
+ boost_time = load_cpu(max_freq_khz);
+
+ /* Disable boost */
+- SAFE_FILE_PRINTF(cleanup, cdrv[id].file, cdrv[id].off_str);
++ SAFE_FILE_PRINTF(cleanup, cdrv[id].file, "%s", cdrv[id].off_str);
+ tst_resm(TINFO, "load CPU0 with boost disabled");
+ boost_off_time = load_cpu(max_freq_khz);
+
+--
+1.9.3
+