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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 29 Sep 2011 08:37:14 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:	linux-kernel@...r.kernel.org,
	OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Subject: Re: [PATCHv4] fat: don't use custom hex_to_bin()

On Thu, 2011-09-29 at 18:10 +0300, Andy Shevchenko wrote:
> diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
[]
> @@ -526,28 +526,16 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname,
>  			     *outlen += 1)
>  			{
>  				if (escape && (*ip == ':')) {
> +					u8 uc[2];
> +
>  					if (i > len - 5)
>  						return -EINVAL;
> -					ec = 0;
> -					for (k = 1; k < 5; k++) {
> -						nc = ip[k];
> -						ec <<= 4;
> -						if (nc >= '0' && nc <= '9') {
> -							ec |= nc - '0';
> -							continue;
> -						}
> -						if (nc >= 'a' && nc <= 'f') {
> -							ec |= nc - ('a' - 10);
> -							continue;
> -						}
> -						if (nc >= 'A' && nc <= 'F') {
> -							ec |= nc - ('A' - 10);
> -							continue;
> -						}
> +
> +					if (hex2bin(uc, ip + 1, 2) < 0)
>  						return -EINVAL;
> -					}
> -					*op++ = ec & 0xFF;
> -					*op++ = ec >> 8;
> +
> +					*(wchar_t *)op++ = uc[0] << 8 | uc[1];

perhaps:

	__le16	foo;

	if (hex2bin((u8 *)&foo, ip + 1, 2) < 0)
		return -EINVAL;
	*(u16 *)op = le16_to_cpu(foo);

	op += 2;

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