public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] tools/intel_reg: Fix segfault in intel_reg dump
Date: Fri, 02 Feb 2018 13:07:43 +0200	[thread overview]
Message-ID: <87a7wrir9c.fsf@intel.com> (raw)
In-Reply-To: <20180202103427.7655-1-mika.kuoppala@linux.intel.com>

On Fri, 02 Feb 2018, Mika Kuoppala <mika.kuoppala@linux.intel.com> wrote:
> We need to zero out the builtin reg spec we are parsing into.
> Otherwise engine will be uninitialized and we segfault when trying
> to find engine and accessing reg->engine in later stage.
>
> Fixes: 7f0be0e7d9be ("tools/intel_reg: Add reading and writing registers through engine")
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104895
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Marta Löfstedt <marta.lofstedt@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Personal preference, I would've gone for = {} but this is fine.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  tools/intel_reg_decode.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/intel_reg_decode.c b/tools/intel_reg_decode.c
> index 46b19676..b351dcb5 100644
> --- a/tools/intel_reg_decode.c
> +++ b/tools/intel_reg_decode.c
> @@ -2748,6 +2748,8 @@ static ssize_t get_regs(struct reg **regs, size_t *nregs, ssize_t index,
>  				&known_registers[i].regs[j];
>  			struct reg reg;
>  
> +			memset(&reg, 0, sizeof(reg));
> +
>  			/* XXX: Could be optimized. */
>  			parse_port_desc(&reg, NULL);

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-02-02 11:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 10:34 [PATCH i-g-t] tools/intel_reg: Fix segfault in intel_reg dump Mika Kuoppala
2018-02-02 11:07 ` Jani Nikula [this message]
2018-02-02 11:28 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-02-02 13:04 ` ✓ Fi.CI.IGT: " Patchwork
2018-02-02 13:19 ` [PATCH i-g-t] " Mika Kuoppala
2018-02-02 13:22   ` Mika Kuoppala
2018-02-02 14:35 ` ✓ Fi.CI.BAT: success for tools/intel_reg: Fix segfault in intel_reg dump (rev2) Patchwork
2018-02-02 16:46 ` ✗ Fi.CI.IGT: warning " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7wrir9c.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mika.kuoppala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox