Re: [PATCH v2 1/6] riscv: Split early and final KASAN population functions

From: Alexandre Ghiti
Date: Tue Jan 24 2023 - 03:00:45 EST


Hi Conor,

On Mon, Jan 23, 2023 at 11:15 PM Conor Dooley <conor@xxxxxxxxxx> wrote:
>
> Hey Alex,
>
> FYI this patch has a couple places with spaces used rather than tabs for
> indent.

Damn, I forgot to run checkpatch this time...

Thanks,

Alex

>
> > static void __init kasan_populate_p4d(pgd_t *pgd,
> > - unsigned long vaddr, unsigned long end,
> > - bool early)
> > + unsigned long vaddr, unsigned long end)
> > {
> > phys_addr_t phys_addr;
> > p4d_t *p4dp, *base_p4d;
> > unsigned long next;
> >
> > - if (early) {
> > - /*
> > - * We can't use pgd_page_vaddr here as it would return a linear
> > - * mapping address but it is not mapped yet, but when populating
> > - * early_pg_dir, we need the physical address and when populating
> > - * swapper_pg_dir, we need the kernel virtual address so use
> > - * pt_ops facility.
> > - */
> > - base_p4d = pt_ops.get_p4d_virt(pfn_to_phys(_pgd_pfn(*pgd)));
> > - } else {
> > - base_p4d = (p4d_t *)pgd_page_vaddr(*pgd);
> > - if (base_p4d == lm_alias(kasan_early_shadow_p4d)) {
> > - base_p4d = memblock_alloc(PTRS_PER_PUD * sizeof(p4d_t), PAGE_SIZE);
> > - memcpy(base_p4d, (void *)kasan_early_shadow_p4d,
> > - sizeof(p4d_t) * PTRS_PER_P4D);
> > - }
> > - }
> > + base_p4d = (p4d_t *)pgd_page_vaddr(*pgd);
> > + if (base_p4d == lm_alias(kasan_early_shadow_p4d)) {
> > + base_p4d = memblock_alloc(PTRS_PER_PUD * sizeof(p4d_t), PAGE_SIZE);
> > + memcpy(base_p4d, (void *)kasan_early_shadow_p4d,
> > + sizeof(p4d_t) * PTRS_PER_P4D);
> > + }
>
> ^^ here.
>
> Thanks,
> Conor.
>