aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu J. Poirier <mathieu.poirier@linaro.org>2013-04-10 09:20:21 -0600
committerAndrey Konovalov <andrey.konovalov@linaro.org>2013-05-25 13:29:15 +0400
commit8f7f94549bb64c808d7388cc0a4ea2df0a4f55c5 (patch)
tree8d85f46868ae4b46d4f4761fc4b771afd1790036
parentf5a36b6f0395bfba8273d259d738dbc826bf5715 (diff)
downloadvexpress-lsk-8f7f94549bb64c808d7388cc0a4ea2df0a4f55c5.tar.gz
cpufreq/arm_big_little.c: Fixing non-terminated string
When declaring char name[9] = "cluster"; name[7] is equal to the string termination character '\0'. But later on doing: name[7] = cluster_id + '0'; clobbers the termination character, leaving non terminated strings in the system and potentially causing undertermined behavior. By initialising name[9] to "clusterX" the 8th character is set to '\0' and affecting the 7th character with the cluster number doesn't overwite anything. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> [ np: The C standard says that the reminder of an initialized array of a known size should be initialized to zero and therefore this patch is unneeded, however this patch makes the intent more explicit to others reading the code. ] Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r--drivers/clk/versatile/clk-vexpress-spc.c2
-rw-r--r--drivers/cpufreq/arm_big_little.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/clk/versatile/clk-vexpress-spc.c b/drivers/clk/versatile/clk-vexpress-spc.c
index d3f8fb44cca..f35b70a0e68 100644
--- a/drivers/clk/versatile/clk-vexpress-spc.c
+++ b/drivers/clk/versatile/clk-vexpress-spc.c
@@ -102,7 +102,7 @@ struct clk *vexpress_clk_register_spc(const char *name, int cluster_id)
#if defined(CONFIG_OF)
void __init vexpress_clk_of_register_spc(void)
{
- char name[9] = "cluster";
+ char name[9] = "clusterX";
struct device_node *node = NULL;
struct clk *clk;
const u32 *val;
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 5ccd099fa94..045ed1c6a0c 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -357,7 +357,7 @@ static void put_cluster_clk_and_freq_table(u32 cluster)
static int _get_cluster_clk_and_freq_table(u32 cluster)
{
- char name[9] = "cluster";
+ char name[9] = "clusterX";
int count;
if (atomic_inc_return(&cluster_usage[cluster]) != 1)