Skip to content
  • Peng Fan's avatar
    2de7852f
    percpu: use nr_groups as check condition · 2de7852f
    Peng Fan authored
    
    
    group_cnt array is defined with NR_CPUS entries, but normally
    nr_groups will not reach up to NR_CPUS. So there is no issue
    to the current code.
    
    Checking other parts of pcpu_build_alloc_info, use nr_groups as
    check condition, so make it consistent to use 'group < nr_groups'
    as for loop check. In case we do have nr_groups equals with NR_CPUS,
    we could also avoid memory access out of bounds.
    
    Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
    Signed-off-by: default avatarDennis Zhou <dennis@kernel.org>
    2de7852f
    percpu: use nr_groups as check condition
    Peng Fan authored
    
    
    group_cnt array is defined with NR_CPUS entries, but normally
    nr_groups will not reach up to NR_CPUS. So there is no issue
    to the current code.
    
    Checking other parts of pcpu_build_alloc_info, use nr_groups as
    check condition, so make it consistent to use 'group < nr_groups'
    as for loop check. In case we do have nr_groups equals with NR_CPUS,
    we could also avoid memory access out of bounds.
    
    Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
    Signed-off-by: default avatarDennis Zhou <dennis@kernel.org>
Loading