From: James Simmons Date: Tue, 1 Jun 2021 23:00:58 +0000 (-0400) Subject: LU-14732 utils: ensure hsm_user_request extent fields are zero X-Git-Tag: 2.14.53~116 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F43893%2F3;p=fs%2Flustre-release.git LU-14732 utils: ensure hsm_user_request extent fields are zero Another patch changed the linking flags for liblustreapi which caused sanit-hsm 29c to fail. Debugging revealed the reason was the extent fields in hsm_user_request sent to the kernel was not zeroed out. For some reason the compiler flags hide this bug. I found this is easily reproduced by removing lhsmtool_posix_DEPENDENCIES which is not needed anyways since the build system can calculate those dependencies for us. Update the function llapi_hsm_user_request_alloc to zero out the struct hsm_user_request allocated. Change-Id: I02c1d6b5cec1ed3e89086a6a00e30ca81768409c Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/43893 Tested-by: jenkins Reviewed-by: Ben Evans Tested-by: Maloo Reviewed-by: Petros Koutoupis Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index a806331..a69ed26 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -235,7 +235,6 @@ l_getidentity_DEPENDENCIES := $(top_builddir)/libcfs/libcfs/libcfs.la lhsmtool_posix_SOURCES = lhsmtool_posix.c pid_file.c pid_file.h lhsmtool_posix_LDADD := liblustreapi.la $(PTHREAD_LIBS) \ $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la -lhsmtool_posix_DEPENDENCIES := liblustreapi.la l_getsepol_SOURCES = l_getsepol.c l_getsepol_LDADD := liblustreapi.la -lcrypto $(SELINUX) diff --git a/lustre/utils/liblustreapi_hsm.c b/lustre/utils/liblustreapi_hsm.c index ba99cd3..a053046 100644 --- a/lustre/utils/liblustreapi_hsm.c +++ b/lustre/utils/liblustreapi_hsm.c @@ -1576,7 +1576,7 @@ struct hsm_user_request *llapi_hsm_user_request_alloc(int itemcount, len += sizeof(struct hsm_user_item) * itemcount; len += data_len; - return (struct hsm_user_request *)malloc(len); + return (struct hsm_user_request *)calloc(1, len); } /**