From aa6b49a76499b0fc3a9e6f3b5f80247e7bbb63d1 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Mon, 6 Mar 2023 10:35:11 -0500 Subject: [PATCH] LU-16509 lnet: memcpy false positive in brw_test The flexible array at the end of srcp_bulk is triggering a false positive in fortified memcpy(). Quash it with unsafe_memcpy(). Lustre-change: https://review.whamcloud.com/50185/ Lustre-commit: 299bd671a9f7c0955b2be59e36bb8239797c1b82 (tbd) Signed-off-by: Patrick Farrell Change-Id: I13386c0a8e73b04af8d398aa49361bfdf6a05ad8 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/50218 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lnet/selftest/brw_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lnet/selftest/brw_test.c b/lnet/selftest/brw_test.c index 13f7568..c43cc8e 100644 --- a/lnet/selftest/brw_test.c +++ b/lnet/selftest/brw_test.c @@ -312,7 +312,9 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu, struct lnet_process_id dest, if (rc != 0) return rc; - memcpy(&rpc->crpc_bulk, bulk, offsetof(struct srpc_bulk, bk_iovs[npg])); + unsafe_memcpy(&rpc->crpc_bulk, bulk, + offsetof(struct srpc_bulk, bk_iovs[npg]), + FLEXIBLE_OBJECT); if (opc == LST_BRW_WRITE) brw_fill_bulk(&rpc->crpc_bulk, flags, BRW_MAGIC); else -- 1.8.3.1