[CIFS] allow cifs_calc_signature2 to deal with a zero length iovec
authorJeff Layton <jlayton@redhat.com>
Sat, 3 Nov 2007 04:34:04 +0000 (04:34 +0000)
committerSteve French <sfrench@us.ibm.com>
Sat, 3 Nov 2007 04:34:04 +0000 (04:34 +0000)
Currently, cifs_calc_signature2 errors out if it gets a zero-length
iovec. Fix it to silently continue in that case.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/cifsencrypt.c

index 632070b4275d91ba46baa1d735b578aeca555462..788f0ad6fedaa12cd0a5b747ec235a53c350dc0a 100644 (file)
@@ -99,11 +99,12 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
        MD5Init(&context);
        MD5Update(&context, (char *)&key->data, key->len);
        for (i = 0; i < n_vec; i++) {
+               if (iov[i].iov_len == 0)
+                       continue;
                if (iov[i].iov_base == NULL) {
                        cERROR(1, ("null iovec entry"));
                        return -EIO;
-               } else if (iov[i].iov_len == 0)
-                       break; /* bail out if we are sent nothing to sign */
+               }
                /* The first entry includes a length field (which does not get
                   signed that occupies the first 4 bytes before the header */
                if (i == 0) {