From: Rajeev Mishra Date: Mon, 6 May 2024 20:12:54 +0000 (+0000) Subject: LU-17817 llapi: avoid potential NULL component X-Git-Tag: 2.15.64~169 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F55028%2F4;p=fs%2Flustre-release.git LU-17817 llapi: avoid potential NULL component Avoid potential NULL dereference for component issue in llapi_layout_file_open() and llapi_layout_file_comp_add() CoverityID: 425352 ("Dereferencing 'comp', which is known to be NULL") HPE-bug-id: LUS-12326 Signed-off-by: Rajeev Mishra Change-Id: Id773fdbf031a2d11256140590f570f90da46ec3a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55028 Reviewed-by: Arshad Hussain Reviewed-by: Shaun Tancheff Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index 310d283..bd2a055 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -1797,7 +1797,7 @@ int llapi_layout_file_open(const char *path, int open_flags, mode_t mode, if (layout) { /* Make sure we are on a Lustre file system */ - if (comp->llc_pool_name[0] != '\0' && + if (comp != NULL && comp->llc_pool_name[0] != '\0' && !lov_pool_is_ignored(comp->llc_pool_name)) { rc = llapi_search_fsname(path, fsname); if (rc) { @@ -2452,7 +2452,7 @@ int llapi_layout_file_comp_add(const char *path, comp = __llapi_layout_cur_comp(layout); - if (comp->llc_pool_name[0] != '\0' && + if (comp != NULL && comp->llc_pool_name[0] != '\0' && !lov_pool_is_ignored(comp->llc_pool_name)) { rc = llapi_search_fsname(path, fsname); if (rc) {