Commit 89542781 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

cifs: get rid of unneeded conditional in cifs_get_num_sgs()

Just have @skip set to 0 after first iterations of the two nested
loops.
Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 3c0070f5
...@@ -2162,6 +2162,12 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst, ...@@ -2162,6 +2162,12 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst,
unsigned long addr; unsigned long addr;
int i, j; int i, j;
/*
* The first rqst has a transform header where the first 20 bytes are
* not part of the encrypted blob.
*/
skip = 20;
/* Assumes the first rqst has a transform header as the first iov. /* Assumes the first rqst has a transform header as the first iov.
* I.e. * I.e.
* rqst[0].rq_iov[0] is transform header * rqst[0].rq_iov[0] is transform header
...@@ -2169,14 +2175,9 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst, ...@@ -2169,14 +2175,9 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst,
* rqst[1+].rq_iov[0+] data to be encrypted/decrypted * rqst[1+].rq_iov[0+] data to be encrypted/decrypted
*/ */
for (i = 0; i < num_rqst; i++) { for (i = 0; i < num_rqst; i++) {
/*
* The first rqst has a transform header where the
* first 20 bytes are not part of the encrypted blob.
*/
for (j = 0; j < rqst[i].rq_nvec; j++) { for (j = 0; j < rqst[i].rq_nvec; j++) {
struct kvec *iov = &rqst[i].rq_iov[j]; struct kvec *iov = &rqst[i].rq_iov[j];
skip = (i == 0) && (j == 0) ? 20 : 0;
addr = (unsigned long)iov->iov_base + skip; addr = (unsigned long)iov->iov_base + skip;
if (unlikely(is_vmalloc_addr((void *)addr))) { if (unlikely(is_vmalloc_addr((void *)addr))) {
len = iov->iov_len - skip; len = iov->iov_len - skip;
...@@ -2185,6 +2186,7 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst, ...@@ -2185,6 +2186,7 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst,
} else { } else {
nents++; nents++;
} }
skip = 0;
} }
nents += rqst[i].rq_npages; nents += rqst[i].rq_npages;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment