Re: [PATCH v8 09/28] x86/insn-eval: Do not BUG on invalid register type

From: Ricardo Neri
Date: Thu Sep 07 2017 - 16:27:29 EST


On Thu, 2017-09-07 at 19:54 +0200, Borislav Petkov wrote:
>
> Also, I meant to add it to pr_fmt. Feel free to merge this hunk ontop
> of
> yours:
>
> ---
> diff --git a/arch/x86/lib/insn-eval.c b/arch/x86/lib/insn-eval.c
> index 3919458fecbf..d46034ddfbb7 100644
> --- a/arch/x86/lib/insn-eval.c
> +++ b/arch/x86/lib/insn-eval.c
> @@ -10,6 +10,9 @@
> Â#include <asm/insn.h>
> Â#include <asm/insn-eval.h>
> Â
> +#undef pr_fmt
> +#define pr_fmt(fmt) "insn: " fmt
> +
> Âenum reg_type {
> ÂÂÂÂÂÂÂÂREG_TYPE_RM = 0,
> ÂÂÂÂÂÂÂÂREG_TYPE_INDEX,
> @@ -86,7 +89,7 @@ static int get_reg_offset(struct insn *insn, struct
> pt_regs *regs,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
> Â
> ÂÂÂÂÂÂÂÂdefault:
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂpr_err_ratelimited("insn: x86: invalid register
> type");
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂpr_err_ratelimited("invalid register type: %d\n",
> type);
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn -EINVAL;
> ÂÂÂÂÂÂÂÂ}
> Â

Oh, I didn't understand your comment initially. Sure, I will add merge
this on top of my patch.

Thanks and BR,
Ricardo