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: <1449695786.25389.67.camel@perches.com>
Date:	Wed, 09 Dec 2015 13:16:26 -0800
From:	Joe Perches <joe@...ches.com>
To:	Keith Busch <keith.busch@...el.com>,
	linux-nvme@...ts.infradead.org, LKML <linux-kernel@...r.kernel.org>
Cc:	Matthew Wilcox <willy@...ux.intel.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jens Axboe <axboe@...com>,
	Christoph Hellwig <hch@...radead.org>,
	Dan Williams <dan.j.williams@...el.com>
Subject: Re: [PATCHv2] printf: Add format for 8-byte EUI-64 type

On Wed, 2015-12-09 at 14:09 -0700, Keith Busch wrote:
> MAC addresses may be formed using rules based on EUI-64, which is 2 bytes
> longer than a typical 6-byte MAC. This patch adds a long specifier to
> the %pM format to support the extended unique identifier.
> 
> Since there are now two cases that use the default ':' separator, this
> initializes the separator during its declaration, and removes the switch
> fall through case.
> 
> Signed-off-by: Keith Busch <keith.busch@...el.com>
> ---
> Changed from previos version:
> 
>   Fixed checks for the 'l' specifier. This can be in fmt[1] or fmt[2],
>   pointed out by Joe Perches from original review (thanks!).
[]
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
[]
> @@ -902,20 +902,33 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
>  
>  	case 'R':
>  		reversed = true;
> -		/* fall through */
> +		break;
> +
> +	case 'l':
> +		bytes = 8;
> +		break;
>  
>  	default:
> -		separator = ':';
>  		break;
>  	}
> +	if (separator == '-' || reversed) {
> +		/* 'F' and 'R' may take additional length specifier */
> +		switch (fmt[2]) {
> +		case 'l':
> +			bytes = 8;
> +			break;
> +		default:
> +			break;
> +		}
> +	}
> 

Using a while (isalpha(*++fmt)) loop like ip6_addr_string_sa
would probably be simpler.
--
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