]> git.karo-electronics.de Git - linux-beck.git/commitdiff
SUNRPC: Use correct type in buffer length calculations
authorChuck Lever <chuck.lever@oracle.com>
Wed, 26 Sep 2007 18:38:10 +0000 (14:38 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 9 Oct 2007 21:20:30 +0000 (17:20 -0400)
Use correct type signage in gss_krb5_remove_padding() when doing length
calculations.  Both xdr_buf.len and iov.iov_len are size_t, which is
unsigned; so use an unsigned type for our temporary length variable to
ensure we don't overflow it..

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/auth_gss/gss_krb5_wrap.c

index 42b3220bed399093ce7008a3b1183109c65e49ee..8bd074df27d36ece4d015dea8b4c5c9144fe95b2 100644 (file)
@@ -42,7 +42,7 @@ gss_krb5_remove_padding(struct xdr_buf *buf, int blocksize)
 {
        u8 *ptr;
        u8 pad;
-       int len = buf->len;
+       size_t len = buf->len;
 
        if (len <= buf->head[0].iov_len) {
                pad = *(u8 *)(buf->head[0].iov_base + len - 1);
@@ -53,9 +53,9 @@ gss_krb5_remove_padding(struct xdr_buf *buf, int blocksize)
        } else
                len -= buf->head[0].iov_len;
        if (len <= buf->page_len) {
-               int last = (buf->page_base + len - 1)
+               unsigned int last = (buf->page_base + len - 1)
                                        >>PAGE_CACHE_SHIFT;
-               int offset = (buf->page_base + len - 1)
+               unsigned int offset = (buf->page_base + len - 1)
                                        & (PAGE_CACHE_SIZE - 1);
                ptr = kmap_atomic(buf->pages[last], KM_USER0);
                pad = *(ptr + offset);