From patchwork Fri Feb 2 13:19:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 10196673 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9908E6037D for ; Fri, 2 Feb 2018 13:20:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88E3B28C0A for ; Fri, 2 Feb 2018 13:20:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C17828E54; Fri, 2 Feb 2018 13:20:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6C99328C0A for ; Fri, 2 Feb 2018 13:20:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03DDD6E12D; Fri, 2 Feb 2018 13:20:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 689AC6E12D for ; Fri, 2 Feb 2018 13:19:59 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 05:19:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,448,1511856000"; d="scan'208";a="24387501" Received: from rosetta.fi.intel.com ([10.237.72.186]) by FMSMGA003.fm.intel.com with ESMTP; 02 Feb 2018 05:19:57 -0800 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id 5819D840546; Fri, 2 Feb 2018 15:19:51 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Fri, 2 Feb 2018 15:19:50 +0200 Message-Id: <20180202131950.24210-1-mika.kuoppala@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180202103427.7655-1-mika.kuoppala@linux.intel.com> References: <20180202103427.7655-1-mika.kuoppala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] tools/intel_reg: Fix segfault in intel_reg dump X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jani Nikula Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Marta Löfstedt Cc: Jani Nikula Signed-off-by: Mika Kuoppala Reviewed-by: Jani Nikula --- 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(®, NULL);