提交 21aa6036 编写于 作者: W Wang ShaoBo 提交者: Zheng Zengkai

cacheinfo: workaround cacheinfo's info_list uninitialized error

hulk inclusion
category: bugfix
bugzilla: 48265
CVE: NA

--------------------------------

Workaround cacheinfo's info_list uninitialized error in some special
cases, such as free_cache_attributes() free info_list but not set
num_leaves to zero when PPTT is not supported. this solution lasts
until upstream issue resolved.

Fixes: 950e5edb ("drivers: base: cacheinfo: Add helper to search cacheinfo by of_node")
Fixes: 709c4362 ("cacheinfo: Move resctrl's get_cache_id() to the cacheinfo header file")
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: NJian Cheng <cj.chengjian@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 1b059882
......@@ -228,6 +228,8 @@ struct cacheinfo *cacheinfo_shared_cpu_map_search(void *fw_token)
for_each_online_cpu(cpu) {
cpu_ci = get_cpu_cacheinfo(cpu);
if (!cpu_ci->info_list)
continue;
for (index = 0; index < cache_leaves(cpu); index++) {
iter = cpu_ci->info_list + index;
......
......@@ -131,6 +131,8 @@ static inline int get_cpu_cacheinfo_id(int cpu, int level)
int i;
for (i = 0; i < ci->num_leaves; i++) {
if (!ci->info_list)
continue;
if (ci->info_list[i].level == level) {
if (ci->info_list[i].attributes & CACHE_ID)
return ci->info_list[i].id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册