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] [thread-next>] [day] [month] [year] [list]
Message-Id: <89f85393-c767-4c0c-90db-d78a2927d465@www.fastmail.com>
Date:   Thu, 22 Sep 2022 23:39:07 +0200
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Mauri Sandberg" <maukka@....kapsi.fi>,
        "Rob Herring" <robh+dt@...nel.org>,
        krzysztof.kozlowski+dt@...aro.org,
        "Olof Johansson" <olof@...om.net>, "Andrew Lunn" <andrew@...n.ch>,
        "Sebastian Hesselbarth" <sebastian.hesselbarth@...il.com>,
        "Gregory Clement" <gregory.clement@...tlin.com>,
        "Russell King" <linux@...linux.org.uk>
Cc:     Pali Rohár <pali@...nel.org>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 3/3] ARM: orion5x: Add D-Link DNS-323 based on Device Tree

On Thu, Sep 22, 2022, at 10:24 PM, Mauri Sandberg wrote:
> +
> +/* dns323_parse_hex_*() taken from tsx09-common.c; should a common 
> copy of these
> + * functions be kept somewhere?
> + */
> +static int __init dns323_parse_hex_nibble(char n)
> +{
> +	if (n >= '0' && n <= '9')
> +		return n - '0';
> +
> +	if (n >= 'A' && n <= 'F')
> +		return n - 'A' + 10;
> +
> +	if (n >= 'a' && n <= 'f')
> +		return n - 'a' + 10;
> +
> +	return -1;
> +}
> +
> +static int __init dns323_parse_hex_byte(const char *b)
> +{
> +	int hi;
> +	int lo;
> +
> +	hi = dns323_parse_hex_nibble(b[0]);
> +	lo = dns323_parse_hex_nibble(b[1]);
> +
> +	if (hi < 0 || lo < 0)
> +		return -1;
> +
> +	return (hi << 4) | lo;
> +}
> +

Can you use simple_strntoull() to parse the address into a u64 instead?

> +static int __init dns323_read_mac_addr(u8 *addr)
> +{
> +	int i;
> +	char *mac_page;
> +
> +	/* MAC address is stored as a regular ol' string in /dev/mtdblock4
> +	 * (0x007d0000-0x00800000) starting at offset 196480 (0x2ff80).
> +	 */
> +	mac_page = ioremap(DNS323_NOR_BOOT_BASE + 0x7d0000 + 196480, 1024);
> +	if (!mac_page)
> +		return -ENOMEM;

It would be nicer to use of_iomap() on the nor device than a
hardcoded physical address here, at least if that doesn't add
too much extra complexity.

     Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ