lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 28 Dec 2017 08:13:33 +0100
From:   Marcin Nowakowski <marcin.nowakowski@...s.com>
To:     Mathieu Malaterre <malat@...ian.org>, <Zubair.Kakakhel@...s.com>
CC:     PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>,
        "Srinivas Kandagatla" <srinivas.kandagatla@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Ralf Baechle <ralf@...ux-mips.org>,
        "David S. Miller" <davem@...emloft.net>,
        "Mauro Carvalho Chehab" <mchehab@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        Paul Cercueil <paul@...pouillou.net>,
        "Linus Walleij" <linus.walleij@...aro.org>,
        Harvey Hunt <harvey.hunt@...tec.com>,
        James Hogan <jhogan@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-mips@...ux-mips.org>
Subject: Re: [PATCH 1/2] nvmem: add driver for JZ4780 efuse

Hi Mathieu, PrasannaKumar,

On 27.12.2017 13:27, Mathieu Malaterre wrote:
> From: PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>
> 
> This patch brings support for the JZ4780 efuse. Currently it only expose
> a read only access to the entire 8K bits efuse memory.
> 
> Tested-by: Mathieu Malaterre <malat@...ian.org>
> Signed-off-by: PrasannaKumar Muralidharan <prasannatsmkumar@...il.com>
> ---

> +
> +/* main entry point */
> +static int jz4780_efuse_read(void *context, unsigned int offset,
> +					void *val, size_t bytes)
> +{
> +	static const int nsegments = sizeof(segments) / sizeof(*segments);
> +	struct jz4780_efuse *efuse = context;
> +	char buf[32];
> +	char *cur = val;
> +	int i;
> +	/* PM recommends read/write each segment separately */
> +	for (i = 0; i < nsegments; ++i) {
> +		unsigned int *segment = segments[i];
> +		unsigned int lpos = segment[0];
> +		unsigned int buflen = segment[1] / 8;
> +		unsigned int ncount = buflen / 32;
> +		unsigned int remain = buflen % 32;
> +		int j;

This doesn't look right, as offset & bytes are completely ignored. This 
means it will return data from an offset other than requested and may 
also overrun the provided output buffer?

> +		/* EFUSE can read or write maximum 256bit in each time */
> +		for (j = 0; j < ncount ; ++j) {
> +			jz4780_efuse_read_32bytes(efuse, buf, lpos);
> +			memcpy(cur, buf, sizeof(buf));
> +			cur += sizeof(buf);
> +			lpos += sizeof(buf);
> +			}
> +		if (remain) {
> +			jz4780_efuse_read_32bytes(efuse, buf, lpos);
> +			memcpy(cur, buf, remain);
> +			cur += remain;
> +			}
> +		}
> +
> +	return 0;
> +}


Marcin


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ