From: Mr NeilBrown Date: Tue, 4 Feb 2020 15:52:22 +0000 (-0500) Subject: LU-13235 lnet: copy the correct amount of CPTs to lnet_cpts X-Git-Tag: 2.13.53~256 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F36636%2F4;p=fs%2Flustre-release.git LU-13235 lnet: copy the correct amount of CPTs to lnet_cpts A previous patch fixed one of three memcpy() calls in lnet_net_append_cpts() to copy the correct number of bytes. This patch fixes the other two. Test-Parameters: trivial testlist=sanity-lnet Fixes: 8cbb8cd3e771 ("LU-7734 lnet: Multi-Rail local NI split") Signed-off-by: Mr NeilBrown Change-Id: I5a3450b0043c60b6c432db5be47f1e27ecc1fc94 Reviewed-on: https://review.whamcloud.com/36636 Tested-by: jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Serguei Smirnov Reviewed-by: Yang Sheng Reviewed-by: Andreas Dilger --- diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index 9559975..7b7d775 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -203,9 +203,10 @@ lnet_net_append_cpts(__u32 *cpts, __u32 ncpts, struct lnet_net *net) goto failed; } - memcpy(array, net->net_cpts, net->net_ncpts); + memcpy(array, net->net_cpts, + net->net_ncpts * sizeof(*net->net_cpts)); loc = array + net->net_ncpts; - memcpy(loc, added_cpts, j); + memcpy(loc, added_cpts, j * sizeof(*net->net_cpts)); LIBCFS_FREE(net->net_cpts, sizeof(*net->net_cpts) * net->net_ncpts);