Whamcloud - gitweb
LU-13235 lnet: copy the correct amount of CPTs to lnet_cpts 36/36636/4
authorMr NeilBrown <neilb@suse.de>
Tue, 4 Feb 2020 15:52:22 +0000 (10:52 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 14 Feb 2020 05:49:16 +0000 (05:49 +0000)
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 <neilb@suse.de>
Change-Id: I5a3450b0043c60b6c432db5be47f1e27ecc1fc94
Reviewed-on: https://review.whamcloud.com/36636
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lnet/lnet/config.c

index 9559975..7b7d775 100644 (file)
@@ -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);