@@ -4457,21 +4457,24 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst,
int rc = -ENOMEM;
for (i = 1; i < num_rqst; i++) {
- npages = old_rq[i - 1].rq_npages;
+ struct smb_rqst *orq = old_rq + i - 1;
+ struct smb_rqst *nrq = new_rq + i;
+
+ npages = orq->rq_npages;
pages = kmalloc_array(npages, sizeof(struct page *),
GFP_KERNEL);
if (!pages)
goto err_free;
- new_rq[i].rq_pages = pages;
- new_rq[i].rq_npages = npages;
- new_rq[i].rq_offset = old_rq[i - 1].rq_offset;
- new_rq[i].rq_pagesz = old_rq[i - 1].rq_pagesz;
- new_rq[i].rq_tailsz = old_rq[i - 1].rq_tailsz;
- new_rq[i].rq_iov = old_rq[i - 1].rq_iov;
- new_rq[i].rq_nvec = old_rq[i - 1].rq_nvec;
+ nrq->rq_pages = pages;
+ nrq->rq_npages = npages;
+ nrq->rq_offset = orq->rq_offset;
+ nrq->rq_pagesz = orq->rq_pagesz;
+ nrq->rq_tailsz = orq->rq_tailsz;
+ nrq->rq_iov = orq->rq_iov;
+ nrq->rq_nvec = orq->rq_nvec;
- orig_len += smb_rqst_len(server, &old_rq[i - 1]);
+ orig_len += smb_rqst_len(server, orq);
for (j = 0; j < npages; j++) {
pages[j] = alloc_page(GFP_KERNEL|__GFP_HIGHMEM);
@@ -4484,14 +4487,14 @@ smb3_init_transform_rq(struct TCP_Server_Info *server, int num_rqst,
char *dst, *src;
unsigned int offset, len;
- rqst_page_get_length(&new_rq[i], j, &len, &offset);
+ rqst_page_get_length(nrq, j, &len, &offset);
- dst = (char *) kmap(new_rq[i].rq_pages[j]) + offset;
- src = (char *) kmap(old_rq[i - 1].rq_pages[j]) + offset;
+ dst = (char *) kmap(nrq->rq_pages[j]) + offset;
+ src = (char *) kmap(orq->rq_pages[j]) + offset;
memcpy(dst, src, len);
- kunmap(new_rq[i].rq_pages[j]);
- kunmap(old_rq[i - 1].rq_pages[j]);
+ kunmap(nrq->rq_pages[j]);
+ kunmap(orq->rq_pages[j]);
}
}
Introduce 'orq' and 'nrq' variable for cleanup code. No functional change. Signed-off-by: Ye Bin <yebin10@huawei.com> --- fs/cifs/smb2ops.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)