Re: [resend][PATCH] fs: use kernel's hex_to_bin() method

Andy Shevchenko
2011-01-04T23:58:59Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1029 bytes --]

On Wed, Jan 5, 2011 at 1:21 AM, Andrew Morton <akpm@linux-foundation.org> wrote:

> After which we can change your patch thusly:
>
> --- a/fs/binfmt_misc.c~fs-binfmt_miscc-use-kernels-hex_to_bin-method-fix
> +++ a/fs/binfmt_misc.c
> @@ -244,9 +244,7 @@ static int unquote(char *from)
>
> Â  Â  Â  Â while ((c = *s++) != '\0') {
> Â  Â  Â  Â  Â  Â  Â  Â if (c == '\\' && *s == 'x') {
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  s++;
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  *p = hex_to_bin(*s++) << 4;
> - Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  *p++ |= hex_to_bin(*s++);
> + Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  s = (char *)hex2bin(p, s + 1, 1);
We need to update both p and s.

In case of '\xAA\xBB' you have result -> '0xBB'.
Am I wrong?

> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â continue;
> Â  Â  Â  Â  Â  Â  Â  Â }
> Â  Â  Â  Â  Â  Â  Â  Â *p++ = c;

--
With Best Regards,
Andy Shevchenko
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éÝ¶\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dÊ‡Ú™ë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥