Whamcloud - gitweb
LU-14732 utils: ensure hsm_user_request extent fields are zero 93/43893/3
authorJames Simmons <jsimmons@infradead.org>
Tue, 1 Jun 2021 23:00:58 +0000 (19:00 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 14 Jun 2021 16:43:26 +0000 (16:43 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/43893
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Ben Evans <beevans@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/Makefile.am
lustre/utils/liblustreapi_hsm.c

index a806331..a69ed26 100644 (file)
@@ -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)
index ba99cd3..a053046 100644 (file)
@@ -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);
 }
 
 /**