diff options
author | Nicolas Pitre <nicolas.pitre@linaro.org> | 2014-10-01 01:03:20 -0400 |
---|---|---|
committer | Tuukka Tikkanen <tuukka.tikkanen@linaro.org> | 2014-10-08 05:43:24 +0300 |
commit | e17edc46405d1150bf3f4a8433c9fddaa5082858 (patch) | |
tree | 34e5e8462f7972bb1bbdf72e6b7b0e32521a0ec1 | |
parent | cbebd248d51c516d8d175f08175d28ebee338045 (diff) |
Fix segfault when no C-state names are available
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
-rw-r--r-- | idlestat.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1148,10 +1148,11 @@ struct cpuidle_cstates *physical_cluster_data(struct cpu_physical *s_phy) if (!cstates) continue; } - /* copy state name from first core */ + /* copy state name from first core (if any) */ s_core = list_first_entry(&s_phy->core_head, struct cpu_core, list_core); - cstates->name = strdup(s_core->cstates->cstate[i].name); + cstates->name = s_core->cstates->cstate[i].name ? + strdup(s_core->cstates->cstate[i].name) : NULL; result->cstate[i] = *cstates; } |