From 572ee90e48c37bdff8869923a0e4f6bd63ec355a Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Tue, 4 Feb 2020 10:52:22 -0500 Subject: [PATCH] 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 --- lnet/lnet/config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); -- 1.8.3.1