Whamcloud - gitweb
LU-16446 utils: fix issues with llapi_get_lmm_from_path() 91/57391/3
authorFrederick Dilger <fdilger@whamcloud.com>
Thu, 12 Dec 2024 08:11:10 +0000 (01:11 -0700)
committerOleg Drokin <green@whamcloud.com>
Sat, 18 Jan 2025 22:05:01 +0000 (22:05 +0000)
commitbed10bb93399971f27295069d82a046cb0995b9a
treef36c0e372fad9c746b3ebc2751e89ef8879b347e
parent22ba71dccbf60372758512124095f42fe7c77fb1
LU-16446 utils: fix issues with llapi_get_lmm_from_path()

size_t was being used for lmmlen when it should have been ssize_t
so that it can hold a negative return value.
comp_v1 was returned by llapi_get_lmm_from_path() but not freed.
lmmbuf was allocated in llapi_get_lmm_from_path() but leaked on error.
file p was opened in llapi_get_lmm_from_path() but leaked on error.

Test-Parameters: trivial
CoverityID: 451724 ("Unsigned compared against 0")
CoverityID: 451710 ("Resource leak")
CoverityID: 451707 ("Resource leak")
Fixes: a796b10fa2 ("LU-16446 utils: specify total count for mirror extend")
Signed-off-by: Frederick Dilger <fdilger@whamcloud.com>
Change-Id: I729d2c2abb8789a82d61858b034dcadf733a4197
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57391
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/utils/lfs.c
lustre/utils/liblustreapi.c