Whamcloud - gitweb
LU-16509 lnet: memcpy false positive in brw_test 85/50185/1
authorPatrick Farrell <pfarrell@whamcloud.com>
Thu, 2 Mar 2023 18:02:25 +0000 (13:02 -0500)
committerPatrick Farrell <pfarrell@whamcloud.com>
Thu, 2 Mar 2023 18:02:25 +0000 (13:02 -0500)
The flexible array at the end of srcp_bulk is triggering a
false positive in fortified memcpy().  Quash it with
unsafe_memcpy().

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I13386c0a8e73b04af8d398aa49361bfdf6a05ad8

lnet/selftest/brw_test.c

index 2e77d8f..8a15306 100644 (file)
@@ -311,7 +311,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