All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Subject: Re: [igt-dev] [PATCH igt v2] tools: Clear unused fields in register spec
Date: Fri, 02 Feb 2018 15:21:50 +0200	[thread overview]
Message-ID: <87vaffv85t.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20180202131546.23512-1-chris@chris-wilson.co.uk>

Chris Wilson <chris@chris-wilson.co.uk> writes:

> If we fail to clear the other fields inside the register spec, that may
> be left with garbage instructing us to access the register via an
> invalid path.
>
> v2: Grab Mika's fix for get_regs() and check all parse_port_desc()
> callers.

Ok. I omit mine.

>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104895
> Fixes: 7f0be0e7d9be ("tools/intel_reg: Add reading and writing registers through engine")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@intel.com>
> CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  tools/intel_reg_decode.c | 2 +-
>  tools/intel_reg_spec.c   | 4 +---
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/tools/intel_reg_decode.c b/tools/intel_reg_decode.c
> index 46b196763..f3c7d74a3 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);
> diff --git a/tools/intel_reg_spec.c b/tools/intel_reg_spec.c
> index 5594d7077..0df69b688 100644
> --- a/tools/intel_reg_spec.c
> +++ b/tools/intel_reg_spec.c
> @@ -219,8 +219,6 @@ static int parse_line(struct reg *reg, const char *line)
>  		initialized = true;
>  	}
>  
> -	memset(reg, 0, sizeof(*reg));
> -
>  	ret = regexec(&regex, line, ARRAY_SIZE(match), match, 0);
>  	if (ret)
>  		ret = -1;
> @@ -267,7 +265,7 @@ static ssize_t parse_file(struct reg **regs, size_t *nregs,
>  	}
>  
>  	while (getline(&line, &linesize, file) != -1) {
> -		struct reg reg;
> +		struct reg reg = {};
>  
>  		lineno++;
>  
> -- 
> 2.15.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-02-02 13:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 10:10 [igt-dev] [PATCH igt] tools: Clear unused fields in register spec Chris Wilson
2018-02-02 10:29 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-02-02 11:16 ` [igt-dev] [PATCH igt] " Jani Nikula
2018-02-02 11:22 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
2018-02-02 13:06 ` [igt-dev] [PATCH igt] " Mika Kuoppala
2018-02-02 13:15 ` [igt-dev] [PATCH igt v2] " Chris Wilson
2018-02-02 13:21   ` Mika Kuoppala [this message]
2018-02-02 13:57 ` [igt-dev] ✓ Fi.CI.BAT: success for tools: Clear unused fields in register spec (rev2) Patchwork
2018-02-02 15:48 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=87vaffv85t.fsf@gaia.fi.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=joonas.lahtinen@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.