diff options
author | Matias Elo <matias.elo@nokia.com> | 2020-04-28 16:28:37 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2020-05-04 09:47:21 +0300 |
commit | cf9ddbbacc0bccc023d7f5cb9f8149e786686206 (patch) | |
tree | 8de8e568ef7992927ee0bc21ac94ad7e8488db8f /platform/linux-generic/odp_system_info.c | |
parent | 72fe59d3e5b06df160748ca3676743843d026c22 (diff) |
linux-gen: sysinfo: check that CONFIG_NUM_CPU_IDS value is large enough
Add check for verifying that CONFIG_NUM_CPU_IDS is large enough to handle
all CPUs in the system.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform/linux-generic/odp_system_info.c')
-rw-r--r-- | platform/linux-generic/odp_system_info.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 62db2d56b..33e193d49 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -360,6 +360,7 @@ static int read_config_file(void) */ int _odp_system_info_init(void) { + int num_cpus; int i; FILE *file; @@ -371,6 +372,13 @@ int _odp_system_info_init(void) if (read_config_file()) return -1; + /* Check that CONFIG_NUM_CPU_IDS is large enough */ + num_cpus = get_nprocs_conf(); + if (num_cpus > CONFIG_NUM_CPU_IDS) + ODP_ERR("Unable to handle all %d " + "CPU IDs. Increase CONFIG_NUM_CPU_IDS value.\n", + num_cpus); + /* By default, read max frequency from a cpufreq file */ for (i = 0; i < CONFIG_NUM_CPU_IDS; i++) { uint64_t cpu_hz_max = read_cpufreq("cpuinfo_max_freq", i); |