From patchwork Fri Feb 2 10:34:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mika Kuoppala X-Patchwork-Id: 10196451 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 32BFA60362 for ; Fri, 2 Feb 2018 10:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11B0B2228E for ; Fri, 2 Feb 2018 10:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05C172625B; Fri, 2 Feb 2018 10:34:43 +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 69C322228E for ; Fri, 2 Feb 2018 10:34:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 85F386E116; Fri, 2 Feb 2018 10:34:40 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AC056E116 for ; Fri, 2 Feb 2018 10:34:39 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 02:34:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,448,1511856000"; d="scan'208";a="200652402" Received: from rosetta.fi.intel.com ([10.237.72.186]) by fmsmga005.fm.intel.com with ESMTP; 02 Feb 2018 02:34:37 -0800 Received: by rosetta.fi.intel.com (Postfix, from userid 1000) id 3D274840546; Fri, 2 Feb 2018 12:34:32 +0200 (EET) From: Mika Kuoppala To: intel-gfx@lists.freedesktop.org Date: Fri, 2 Feb 2018 12:34:27 +0200 Message-Id: <20180202103427.7655-1-mika.kuoppala@linux.intel.com> X-Mailer: git-send-email 2.14.1 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. 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, 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(®, 0, sizeof(reg)); + /* XXX: Could be optimized. */ parse_port_desc(®, NULL);