On Fri, 31 Aug 2018, Andy Lutomirski wrote:
> @@ -671,6 +705,48 @@ show_fault_oops(struct pt_regs *regs, unsigned long 
> error_code,
>                address < PAGE_SIZE ? "NULL pointer dereference" : "paging 
> request",
>                (void *)address);
>  
> +     errcode[0] = 0;

error_code vs. errcode ? errtxt perhaps?

> +#define ERRSTR(x) if (error_code & X86_PF_##x) strcat(errcode, " " #x)
> +     ERRSTR(PROT);
> +     ERRSTR(WRITE);
> +     ERRSTR(USER);
> +     ERRSTR(RSVD);
> +     ERRSTR(INSTR);
> +     ERRSTR(PK);
> +#undef ERRSTR

Eeew. That's too ugly to live.

static inline errstr(unsigned long ec, char *buf, unsigned long mask,
                     const char *txt)
{
        ....
}

and then

        errstr(error_code, errtxt, X86_PF_PROT, "PROT");

Yes, it's slightly more to type but this macro mess in the middle of the
code just makes my eyes bleed.

Thanks,

        tglx

Reply via email to