Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700317

Re: [PATCH v5] vfat: Deduplicate hex2bin()

From OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Newsgroups linux.kernel
Subject Re: [PATCH v5] vfat: Deduplicate hex2bin()
Date 2017-07-31 20:50 +0200
Message-ID <u9nVn-1jR-15@gated-at.bofh.it> (permalink)
References <u9k1s-7qO-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

> We may use hex2bin() instead of custom approach.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

[...]

> +	u8 hc[2];

Let's move this to following more local scope.

>  	if (utf8) {
>  		*outlen = utf8s_to_utf16s(name, len, UTF16_HOST_ENDIAN,
> @@ -532,31 +532,16 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname,
>  			if (escape && (*ip == ':')) {
				u8 uc[2];

Here.

>  				if (i > len - 5)
>  					return -EINVAL;

[...]

> +				fill = hex2bin(hc, ip + 1, 2);
> +				if (fill)
> +					return fill;

This should not use random errno (in this case, it is -1 (EPERM)).

> +				*op++ = hc[1];
> +				*op++ = hc[0];

Maybe, originally endian bug?

>  				ip += 5;
>  				i += 5;
>  			} else {
> -				charlen = nls->char2uni(ip, len - i,
> -									(wchar_t *)op);
> +				charlen = nls->char2uni(ip, len - i, (wchar_t *)op);
>  				if (charlen < 0)
>  					return -EINVAL;
>  				ip += charlen;

I will send a modified patch.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5] vfat: Deduplicate hex2bin() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-07-31 16:40 +0200
  [PATCH v5] vfat: Deduplicate hex2bin() OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - 2017-07-31 20:50 +0200
    Re: [PATCH v5] vfat: Deduplicate hex2bin() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-31 21:40 +0200
      Re: [PATCH v5] vfat: Deduplicate hex2bin() OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - 2017-07-31 23:00 +0200
        Re: [PATCH v5] vfat: Deduplicate hex2bin() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-08-01 15:00 +0200
  Re: [PATCH v5] vfat: Deduplicate hex2bin() OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - 2017-07-31 20:50 +0200
    Re: [PATCH v5] vfat: Deduplicate hex2bin() Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-07-31 21:40 +0200
      Re: [PATCH v5] vfat: Deduplicate hex2bin() OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - 2017-07-31 23:00 +0200

csiph-web