From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751701AbdGaSkp (ORCPT ); Mon, 31 Jul 2017 14:40:45 -0400 Received: from mail.parknet.co.jp ([210.171.160.6]:52314 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751625AbdGaSkm (ORCPT ); Mon, 31 Jul 2017 14:40:42 -0400 From: OGAWA Hirofumi To: Andy Shevchenko Cc: linux-kernel@vger.kernel.org, Joe Perches Subject: Re: [PATCH v5] vfat: Deduplicate hex2bin() References: <20170731143349.84629-1-andriy.shevchenko@linux.intel.com> Date: Tue, 01 Aug 2017 03:40:38 +0900 In-Reply-To: <20170731143349.84629-1-andriy.shevchenko@linux.intel.com> (Andy Shevchenko's message of "Mon, 31 Jul 2017 17:33:49 +0300") Message-ID: <877eyov49l.fsf@devron> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andy Shevchenko writes: > We may use hex2bin() instead of custom approach. > > Signed-off-by: Andy Shevchenko [...] > + 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