]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/crimson/test_socket: fix unaligned memory access
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 10 Mar 2023 01:55:44 +0000 (09:55 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Sun, 25 Jun 2023 03:57:19 +0000 (11:57 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/test/crimson/test_socket.cc

index 6d082c101bfbf5ee01140d82b8bfae25a51f3521..916583cc5c5f239be3341531e48ccf4e7e8e219c 100644 (file)
@@ -341,7 +341,8 @@ class Connection {
           } else {
             return socket->read_exactly(DATA_SIZE * sizeof(uint64_t)
             ).then([this](auto buf) {
-              auto read_data = reinterpret_cast<const uint64_t*>(buf.get());
+              uint64_t read_data[DATA_SIZE];
+              std::memcpy(read_data, buf.get(), DATA_SIZE * sizeof(uint64_t));
               verify_data_read(read_data);
             });
           }