Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.24.4 /crypto/xcbc.c

Filename:/crypto/xcbc.c
Lines Added:5
Lines Deleted:1
Also changed in: (Previous) 2.6.24.4-rc3  2.6.24.4-rc2  2.6.24.4-rc1  2.6.24-git22  2.6.24-git21  2.6.24-git20 
(Following) 2.6.24.5-rc1  2.6.24.5-rc2  2.6.24.5  2.6.24.6  2.6.24.7  2.6.25-rc7 

Location
[  2.6.24.4
  [  crypto
     o  xcbc.c

Patch

diff --git a/crypto/xcbc.c b/crypto/xcbc.c
index ac68f3b..a957373 100644
--- a/crypto/xcbc.c
+++ b/crypto/xcbc.c
@@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
       unsigned int offset = sg[i].offset;
       unsigned int slen = sg[i].length;
 
+      if (unlikely(slen > nbytes))
+         slen = nbytes;
+
+      nbytes -= slen;
+
       while (slen > 0) {
          unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset);
          char *p = crypto_kmap(pg, 0) + offset;
@@ -177,7 +182,6 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
          offset = 0;
          pg++;
       }
-      nbytes-=sg[i].length;
       i++;
    } while (nbytes>0);
 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.