Whamcloud - gitweb
LU-9679 libcfs: Add CFS_ALLOC_PTR_ARRAY and free 75/36975/6
authorMr NeilBrown <neilb@suse.de>
Thu, 14 Nov 2019 02:59:39 +0000 (13:59 +1100)
committerOleg Drokin <green@whamcloud.com>
Thu, 5 Mar 2020 22:35:20 +0000 (22:35 +0000)
commitb1f6f3becedc93004773eb1242d838827815743d
treed7ba387c8c01d4d6fd0b5ec35ef56fa145ed099f
parentcae8d0e7120a356e0218783e0678d405306b5da4
LU-9679 libcfs: Add CFS_ALLOC_PTR_ARRAY and free

Following the pattern of CFS_ALLOC_PTR() and the kernel
pattern of kmalloc_array(), add
  CFS_ALLOC_PTR_ARRAY()
and
  CFS_FREE_PTR_ARRAY()

which allocate and free arrays given a pointer to
the array, and a number of elements

This makes code easier to read and could be a step
toward using the kernel's hardened alloc_array interfaces,
which insure the multiplication doesn't overflow.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I54c919bd9ce22fbc72715c3da16f8c29e7135ccc
Reviewed-on: https://review.whamcloud.com/36975
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
16 files changed:
libcfs/include/libcfs/libcfs_private.h
libcfs/libcfs/libcfs_cpu.c
libcfs/libcfs/libcfs_string.c
lnet/klnds/gnilnd/gnilnd.c
lnet/klnds/gnilnd/gnilnd_conn.c
lnet/klnds/gnilnd/gnilnd_proc.c
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/socklnd/socklnd_cb.c
lnet/lnet/api-ni.c
lnet/lnet/config.c
lnet/lnet/lib-msg.c
lnet/lnet/lib-ptl.c
lnet/lnet/peer.c
lnet/selftest/console.c
lnet/selftest/module.c
lustre/obdclass/lprocfs_status.c