open-power / skiboot

OPAL boot and runtime firmware for POWER

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

if l->len == 16G,mem_clear_njobs will be added twice

wongkq opened this issue · comments

commented

mem_clear_njobs += r->len / MEM_REGION_CLEAR_JOB_SIZE;

if l->len == 16G, mem_clear_njobs will be added twice,but when assigned for job_args[i], it is only assigned once。Is this a bug?

I haven't verified to be sure, but from examining the code I think it may be a bug. It should probably be something like

        mem_clear_njobs += (r->len - 1) / MEM_REGION_CLEAR_JOB_SIZE;

I don't think this causes any functional problem, it just means we allocate more than is needed here:

skiboot/core/mem_region.c

Lines 1320 to 1321 in 80e2b1d

jobs = malloc(mem_clear_njobs * sizeof(struct cpu_job*));
job_args = malloc(mem_clear_njobs * sizeof(struct mem_region_clear_job_args));

commented

thanks