Skip to content

Commit 8954278

Browse files
Paulo Alcantarasmfrench
authored andcommitted
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: Paulo Alcantara (SUSE) <pc@cjr.nz> Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 3c0070f commit 8954278

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fs/cifs/cifsglob.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,21 +2162,22 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst,
21622162
unsigned long addr;
21632163
int i, j;
21642164

2165+
/*
2166+
* The first rqst has a transform header where the first 20 bytes are
2167+
* not part of the encrypted blob.
2168+
*/
2169+
skip = 20;
2170+
21652171
/* Assumes the first rqst has a transform header as the first iov.
21662172
* I.e.
21672173
* rqst[0].rq_iov[0] is transform header
21682174
* rqst[0].rq_iov[1+] data to be encrypted/decrypted
21692175
* rqst[1+].rq_iov[0+] data to be encrypted/decrypted
21702176
*/
21712177
for (i = 0; i < num_rqst; i++) {
2172-
/*
2173-
* The first rqst has a transform header where the
2174-
* first 20 bytes are not part of the encrypted blob.
2175-
*/
21762178
for (j = 0; j < rqst[i].rq_nvec; j++) {
21772179
struct kvec *iov = &rqst[i].rq_iov[j];
21782180

2179-
skip = (i == 0) && (j == 0) ? 20 : 0;
21802181
addr = (unsigned long)iov->iov_base + skip;
21812182
if (unlikely(is_vmalloc_addr((void *)addr))) {
21822183
len = iov->iov_len - skip;
@@ -2185,6 +2186,7 @@ static inline unsigned int cifs_get_num_sgs(const struct smb_rqst *rqst,
21852186
} else {
21862187
nents++;
21872188
}
2189+
skip = 0;
21882190
}
21892191
nents += rqst[i].rq_npages;
21902192
}

0 commit comments

Comments
 (0)