Message ID | 9ff9c1f334999e0128fe6426aaad4e9d465f310f.1285051188.git.andy.shevchenko@gmail.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
From: Andy Shevchenko <andy.shevchenko@gmail.com> Date: Tue, 21 Sep 2010 09:40:25 +0300 > Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Cc: Trond Myklebust <Trond.Myklebust@netapp.com> > Cc: linux-nfs@vger.kernel.org I'll let the NFS folks pick this one up. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Sep 21, 2010 at 09:40:25AM +0300, Andy Shevchenko wrote: > Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Cc: Trond Myklebust <Trond.Myklebust@netapp.com> > Cc: linux-nfs@vger.kernel.org Thanks, applied for 2.6.37. --b. > --- > net/sunrpc/cache.c | 20 +++++++++++++------- > 1 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c > index 5b7b56f..c944a24 100644 > --- a/net/sunrpc/cache.c > +++ b/net/sunrpc/cache.c > @@ -1171,13 +1171,19 @@ int qword_get(char **bpp, char *dest, int bufsize) > if (bp[0] == '\\' && bp[1] == 'x') { > /* HEX STRING */ > bp += 2; > - while (isxdigit(bp[0]) && isxdigit(bp[1]) && len < bufsize) { > - int byte = isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10; > - bp++; > - byte <<= 4; > - byte |= isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10; > - *dest++ = byte; > - bp++; > + while (len < bufsize) { > + int h, l; > + > + h = hex_to_bin(bp[0]); > + if (h < 0) > + break; > + > + l = hex_to_bin(bp[1]); > + if (l < 0) > + break; > + > + *dest++ = (h << 4) | l; > + bp += 2; > len++; > } > } else { > -- > 1.7.2.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 5b7b56f..c944a24 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -1171,13 +1171,19 @@ int qword_get(char **bpp, char *dest, int bufsize) if (bp[0] == '\\' && bp[1] == 'x') { /* HEX STRING */ bp += 2; - while (isxdigit(bp[0]) && isxdigit(bp[1]) && len < bufsize) { - int byte = isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10; - bp++; - byte <<= 4; - byte |= isdigit(*bp) ? *bp-'0' : toupper(*bp)-'A'+10; - *dest++ = byte; - bp++; + while (len < bufsize) { + int h, l; + + h = hex_to_bin(bp[0]); + if (h < 0) + break; + + l = hex_to_bin(bp[1]); + if (l < 0) + break; + + *dest++ = (h << 4) | l; + bp += 2; len++; } } else {
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: linux-nfs@vger.kernel.org --- net/sunrpc/cache.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-)