lkml.org 
[lkml]   [2011]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCHv3] fat: don't use custom hex_to_bin()
Date
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

> + /* The ip contains 2 bytes in little
> + * endian format. We need to get them
> + * in native endian. */
> +
> + rc = hex2bin(op++, ip + 3, 1);
> + if (rc < 0)
> + return -EINVAL;
> +
> + rc = hex2bin(op++, ip + 1, 1);
> + if (rc < 0)
> return -EINVAL;
> - }
> - *op++ = ec & 0xFF;
> - *op++ = ec >> 8;
> +

It will not work for big endian arch correctly like original code.

"ip" is made like following,

if (uni_xlate == 1) {
*op++ = ':';
op = pack_hex_byte(op, ec >> 8);
op = pack_hex_byte(op, ec);
len -= 5;
} else {


Maybe, my explanation was not good. Like above, "ip" format is like
":1234" (can say big endian, it's the string though), so, this code made
a unicode char (op) as little endian.

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


\
 
 \ /
  Last update: 2011-09-29 16:55    [W:0.138 / U:1.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site