From e392bcad8998c958bef81c3e4905f36a3a4b1a95 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 2 May 2015 11:26:19 +0200 Subject: [PATCH] scst_lib: WRITE SAME performance improvement fix Fix the argument of the second kunmap() call. Detected by smatch. See also patch "scst_lib: Improve WRITE SAME performance" (commit ID a15628d68309). Note: this patch does not have any impact on 64-bit architectures since kunmap() doesn't to anything on such architectures. Signed-off-by: Bart Van Assche --- scst/src/scst_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index dc9c8f623..e253acc14 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -5866,16 +5866,18 @@ void scst_write_same(struct scst_cmd *cmd) if (cmd->bufflen <= PAGE_SIZE / 2) pg = alloc_page(GFP_KERNEL); if (pg) { + struct page *src_pg; void *src, *dst; int k; mult = 0; - src = kmap(sg_page(cmd->sg)); + src_pg = sg_page(cmd->sg); + src = kmap(src_pg); dst = kmap(pg); for (k = 0; k < PAGE_SIZE; k += cmd->bufflen, mult++) memcpy(dst + k, src + cmd->sg->offset, cmd->bufflen); kunmap(pg); - kunmap(src); + kunmap(src_pg); offset = 0; length = k; } else {