irqbalance: initialize package_mask before using in do_one_cpu()
The local variable package_mask is used without initialized. add cpus_clear(package_mask) before using, and move it to the error path where getting packpage_mask fail from core_siblings. In addition, the variable cache_mask is called cpu_set() twice, which is unnecessary, so delete the redundant code. Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
This commit is contained in:
parent
8799a564dc
commit
47137bb3e7
|
@ -299,12 +299,13 @@ static void do_one_cpu(char *path)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu_set(cpu->number, package_mask);
|
|
||||||
|
|
||||||
/* try to read the package mask; if it doesn't exist assume solitary */
|
/* try to read the package mask; if it doesn't exist assume solitary */
|
||||||
snprintf(new_path, ADJ_SIZE(path, "/topology/core_siblings"),
|
snprintf(new_path, ADJ_SIZE(path, "/topology/core_siblings"),
|
||||||
"%s/topology/core_siblings", path);
|
"%s/topology/core_siblings", path);
|
||||||
process_one_line(new_path, get_mask_from_bitmap, &package_mask);
|
if (process_one_line(new_path, get_mask_from_bitmap, &package_mask)) {
|
||||||
|
cpus_clear(package_mask);
|
||||||
|
cpu_set(cpu->number, package_mask);
|
||||||
|
}
|
||||||
|
|
||||||
/* try to read the package id */
|
/* try to read the package id */
|
||||||
snprintf(new_path, ADJ_SIZE(path, "/topology/physical_package_id"),
|
snprintf(new_path, ADJ_SIZE(path, "/topology/physical_package_id"),
|
||||||
|
@ -313,7 +314,6 @@ static void do_one_cpu(char *path)
|
||||||
|
|
||||||
/* try to read the cache mask; if it doesn't exist assume solitary */
|
/* try to read the cache mask; if it doesn't exist assume solitary */
|
||||||
/* We want the deepest cache level available */
|
/* We want the deepest cache level available */
|
||||||
cpu_set(cpu->number, cache_mask);
|
|
||||||
max_cache_index = 0;
|
max_cache_index = 0;
|
||||||
cache_index = 1;
|
cache_index = 1;
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Reference in a new issue