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]
Message-ID: <53A9755F.9000403@imgtec.com>
Date:	Tue, 24 Jun 2014 13:55:59 +0100
From:	James Hogan <james.hogan@...tec.com>
To:	Daniel Walter <dwalter@...gle.com>,
	Ralf Baechle <ralf@...ux-mips.org>
CC:	<linux-mips@...ux-mips.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] arch/mips/rb532: replace mac_addr parsing

On 24/06/14 12:14, Daniel Walter wrote:
> Replace parse_mac_addr with mac_pton().
> 
> 
> Signed-off-by: Daniel Walter <dwalter@...gle.com>

Reviewed-by: James Hogan <james.hogan@...tec.com>

Cheers
James

> ---
> Changes since v2
>   Use mac_pton() instead of sscanf()
>   added error handling in case could not be parsed
> ---
> Patch applies against current linux-git
> ---
>  arch/mips/rb532/devices.c | 27 ++++-----------------------
>  1 file changed, 4 insertions(+), 23 deletions(-)
> ---
> diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
> index 3af00b2..03a4cdc 100644
> --- a/arch/mips/rb532/devices.c
> +++ b/arch/mips/rb532/devices.c
> @@ -250,28 +250,6 @@ static struct platform_device *rb532_devs[] = {
>  	&rb532_wdt
>  };
>  
> -static void __init parse_mac_addr(char *macstr)
> -{
> -	int i, h, l;
> -
> -	for (i = 0; i < 6; i++) {
> -		if (i != 5 && *(macstr + 2) != ':')
> -			return;
> -
> -		h = hex_to_bin(*macstr++);
> -		if (h == -1)
> -			return;
> -
> -		l = hex_to_bin(*macstr++);
> -		if (l == -1)
> -			return;
> -
> -		macstr++;
> -		korina_dev0_data.mac[i] = (h << 4) + l;
> -	}
> -}
> -
> -
>  /* NAND definitions */
>  #define NAND_CHIP_DELAY 25
>  
> @@ -333,7 +311,10 @@ static int __init plat_setup_devices(void)
>  static int __init setup_kmac(char *s)
>  {
>  	printk(KERN_INFO "korina mac = %s\n", s);
> -	parse_mac_addr(s);
> +	if (!mac_pton(s, korina_dev0_data.mac)) {
> +		printk(KERN_ERR "Invalid mac\n");
> +		return -EINVAL;
> +	}
>  	return 0;
>  }
>  
> 
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ