From: Niu Yawei Date: Wed, 17 May 2017 08:07:07 +0000 (-0400) Subject: LU-9513 liblustre: always check return value X-Git-Tag: 2.9.59~68 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b58fcb7fe4f63830ccc3e6c1747cb1b361d481dd;p=fs%2Flustre-release.git 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 --- 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;