sunrpc/cache: don't use custom hex_to_bin() converter
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: linux-nfs@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
1117449276
commit
e7f483eabe
@ -1179,13 +1179,19 @@ int qword_get(char **bpp, char *dest, int bufsize)
|
|||||||
if (bp[0] == '\\' && bp[1] == 'x') {
|
if (bp[0] == '\\' && bp[1] == 'x') {
|
||||||
/* HEX STRING */
|
/* HEX STRING */
|
||||||
bp += 2;
|
bp += 2;
|
||||||
while (isxdigit(bp[0]) && isxdigit(bp[1]) && len < bufsize) {
|
while (len < bufsize) {
|
||||||
int byte = isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10;
|
int h, l;
|
||||||
bp++;
|
|
||||||
byte <<= 4;
|
h = hex_to_bin(bp[0]);
|
||||||
byte |= isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10;
|
if (h < 0)
|
||||||
*dest++ = byte;
|
break;
|
||||||
bp++;
|
|
||||||
|
l = hex_to_bin(bp[1]);
|
||||||
|
if (l < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
*dest++ = (h << 4) | l;
|
||||||
|
bp += 2;
|
||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user