[PATCH v3 3/3] riscv: Add cache information in AUX vector

Pekka Enberg penberg at gmail.com
Sun Aug 30 04:01:22 EDT 2020


On Fri, Aug 28, 2020 at 10:09 AM Zong Li <zong.li at sifive.com> wrote:
> +uintptr_t get_cache_geometry(u32 level, enum cache_type type)
> +{
> +       struct cacheinfo *this_leaf = get_cacheinfo(level, type);
> +       uintptr_t ret = (this_leaf->ways_of_associativity << 16 |
> +                        this_leaf->coherency_line_size);

You are dereferencing "this_leaf" without checking if it's NULL here.

> +
> +       return this_leaf ? ret : 0;
> +}

- Pekka



More information about the linux-riscv mailing list