From: Wang Shilong Date: Fri, 10 Jul 2020 07:29:39 +0000 (+0800) Subject: LU-13775 target: fix memory copy in tgt_pages2shortio() X-Git-Tag: 2.13.56~124 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=b8faae3756e5ded135b392209125975807021691 LU-13775 target: fix memory copy in tgt_pages2shortio() tgt_pages2shortio() try to copy local pages memory to ptlrpc inline buf. The right logic should move page @ptr to offset + count, however, it does this logic wrongly, this doesn't cause any problem so far, because normally @lnb_page_offset is 0. when i tried to play with unaligned DIO, we could hit the problem. Anyway, fix to use right logic to handle memory. Fixes: 70f092a ("LU-1757 brw: add short io osc/ost transfer.") Signed-off-by: Wang Shilong Change-Id: I0a2e05732c0f425043af8393eb41f6bec178da6f Reviewed-on: https://review.whamcloud.com/39333 Reviewed-by: Patrick Farrell Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo --- diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index f585359..593fa72 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -1983,7 +1983,7 @@ static int tgt_pages2shortio(struct niobuf_local *local, int npages, return -EINVAL; ptr = kmap_atomic(local[i].lnb_page); - memcpy(buf + off, ptr, len); + memcpy(buf, ptr + off, len); kunmap_atomic(ptr); buf += len; size -= len;