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

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.

v2: use {} (Jani)

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>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_reg_decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/intel_reg_decode.c b/tools/intel_reg_decode.c
index 46b19676..f3c7d74a 100644
--- a/tools/intel_reg_decode.c
+++ b/tools/intel_reg_decode.c
@@ -2746,7 +2746,7 @@ static ssize_t get_regs(struct reg **regs, size_t *nregs, ssize_t index,
 		for (j = 0; j < known_registers[i].count; j++) {
 			const struct reg_debug *reg_in =
 				&known_registers[i].regs[j];
-			struct reg reg;
+			struct reg reg = {};
 
 			/* XXX: Could be optimized. */
 			parse_port_desc(&reg, NULL);
-- 
2.14.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-02-02 13:19 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
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 ` Mika Kuoppala [this message]
2018-02-02 13:22   ` [PATCH i-g-t] " 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=20180202131950.24210-1-mika.kuoppala@linux.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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