gss_krb5_crypto.c | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-) diff -u --recursive --new-file --show-c-function linux-2.6.5-08-short_rw/net/sunrpc/auth_gss/gss_krb5_crypto.c linux-2.6.5-09-fix_integrity/net/sunrpc/auth_gss/gss_krb5_crypto.c --- linux-2.6.5-08-short_rw/net/sunrpc/auth_gss/gss_krb5_crypto.c 2004-03-23 10:32:52.000000000 -0500 +++ linux-2.6.5-09-fix_integrity/net/sunrpc/auth_gss/gss_krb5_crypto.c 2004-03-24 00:46:39.000000000 -0500 @@ -40,6 +40,7 @@ #include #include #include +#include #include #ifdef RPC_DEBUG @@ -171,22 +172,24 @@ krb5_make_checksum(s32 cksumtype, char * } len = body->page_len; - offset = body->page_base; - i = 0; - while (len) { - sg->page = body->pages[i]; - sg->offset = offset; - offset = 0; - if (PAGE_SIZE > len) - thislen = len; - else - thislen = PAGE_SIZE; - sg->length = thislen; - kmap(sg->page); /* XXX kmap_atomic? */ - crypto_digest_update(tfm, sg, 1); - kunmap(sg->page); - len -= thislen; - i++; + if (len != 0) { + offset = body->page_base & (PAGE_CACHE_SIZE - 1); + i = body->page_base >> PAGE_CACHE_SHIFT; + thislen = PAGE_CACHE_SIZE - offset; + do { + if (thislen > len) + thislen = len; + sg->page = body->pages[i]; + sg->offset = offset; + sg->length = thislen; + kmap(sg->page); /* XXX kmap_atomic? */ + crypto_digest_update(tfm, sg, 1); + kunmap(sg->page); + len -= thislen; + i++; + offset = 0; + thislen = PAGE_CACHE_SIZE; + } while(len != 0); } if (body->tail[0].iov_len) { buf_to_sg(sg, body->tail[0].iov_base, body->tail[0].iov_len);