[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.11.1505042131440.4225@nanos>
Date: Mon, 4 May 2015 21:40:54 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
cc: Ingo Molnar <mingo@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
x86@...nel.org, LKML <linux-kernel@...r.kernel.org>,
pebolle@...cali.nl
Subject: Re: [PATCH v2] x86: punit_atom: punit device state debug driver
On Mon, 4 May 2015, Srinivas Pandruvada wrote:
> +struct punit_device {
> + char *name;
> + int reg;
> + int sss_pos;
> +};
> +
> +static struct punit_device *punit_device;
So this pointer gets initialized in punit_atom_debug_init() and points
either to punit_device_byt or punit_device_cht.
> +static const struct punit_device punit_device_byt[] = {
> + { "GFX RENDER", PWRGT_STATUS, RENDER_POS },
...
> + { NULL }
> +};
> +static int punit_dev_state_show(struct seq_file *seq_file, void *unused)
> +{
> + u32 punit_pwr_status;
> + int index;
> + int status;
> +
> + seq_puts(seq_file, "\n\nPUNIT NORTH COMPLEX DEVICES :\n");
> + while (punit_device->name) {
> + status = iosf_mbi_read(PUNIT_PORT, BT_MBI_PMC_READ,
> + punit_device->reg,
> + &punit_pwr_status);
> + if (status)
> + seq_printf(seq_file, "%9s : Read Failed\n",
> + punit_device->name);
> + else {
> + index = (punit_pwr_status >> punit_device->sss_pos) & 3;
> + seq_printf(seq_file, "%9s : %s\n", punit_device->name,
> + dstates[index]);
> + }
> + punit_device++;
So you happily increment the above pointer. So after the first readout
of that debug file the pointer will point to the end of that
table. And any further readouts will simply fail.
Completely useless and untested crap.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists