From b58fcb7fe4f63830ccc3e6c1747cb1b361d481dd Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Wed, 17 May 2017 04:07:07 -0400 Subject: [PATCH] LU-9513 liblustre: always check return value Always check if the return value of __llapi_layout_cur_comp() is NULL. Signed-off-by: Niu Yawei Change-Id: Ibc803de5f27b981b0daa5e7be1a18adde9a46a18 Reviewed-on: https://review.whamcloud.com/27154 Reviewed-by: Bobi Jam Reviewed-by: Dmitry Eremin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/utils/liblustreapi_layout.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index 557765d..dbf1369 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -1962,6 +1962,11 @@ int llapi_layout_file_comp_del(const char *path, uint32_t id, uint32_t flags) llapi_layout_comp_extent_set(layout, 0, LUSTRE_EOF); comp = __llapi_layout_cur_comp(layout); + if (comp == NULL) { + llapi_layout_free(layout); + return -1; + } + comp->llc_id = id; comp->llc_flags = flags; -- 1.8.3.1