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]
Date:	Tue, 24 Jun 2014 08:48:38 -0700
From:	Joe Perches <joe@...ches.com>
To:	Daniel Walter <dwalter@...gle.com>
Cc:	Ralf Baechle <ralf@...ux-mips.org>, linux-mips@...ux-mips.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] ar7: replace mac address parsing

On Tue, 2014-06-24 at 16:39 +0100, Daniel Walter wrote:
> Replace sscanf() with mac_pton().
[]
> diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
[]
> @@ -307,10 +307,7 @@ static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
>  	}
>  
>  	if (mac) {
> -		if (sscanf(mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
> -					&dev_addr[0], &dev_addr[1],
> -					&dev_addr[2], &dev_addr[3],
> -					&dev_addr[4], &dev_addr[5]) != 6) {
> +		if (!mac_pton(mac, dev_addr)) {

There is a slight functional change with this conversion.

mac_pton is strict about leading 0's and requires a 17 char strlen.

sscanf will accept 0:1:2:3:4:5, mac_pton will not.

>  			pr_warning("cannot parse mac address, "
>  					"using random address\n");

could be coalesced and pr_warn

			pr_warn("cannot parse mac address - using random address\n");


--
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