@@ -1335,19 +1335,16 @@ __u8 smb2_map_lease_to_oplock(__le32 lease_state)
13351335 */
13361336void create_lease_buf (u8 * rbuf , struct lease * lease )
13371337{
1338- char * LeaseKey = (char * )& lease -> lease_key ;
1339-
13401338 if (lease -> version == 2 ) {
13411339 struct create_lease_v2 * buf = (struct create_lease_v2 * )rbuf ;
1342- char * ParentLeaseKey = (char * )& lease -> parent_lease_key ;
13431340
13441341 memset (buf , 0 , sizeof (struct create_lease_v2 ));
1345- buf -> lcontext .LeaseKeyLow = * (( __le64 * ) LeaseKey );
1346- buf -> lcontext . LeaseKeyHigh = * (( __le64 * )( LeaseKey + 8 ) );
1342+ memcpy ( buf -> lcontext .LeaseKey , lease -> lease_key ,
1343+ SMB2_LEASE_KEY_SIZE );
13471344 buf -> lcontext .LeaseFlags = lease -> flags ;
13481345 buf -> lcontext .LeaseState = lease -> state ;
1349- buf -> lcontext .ParentLeaseKeyLow = * (( __le64 * ) ParentLeaseKey );
1350- buf -> lcontext . ParentLeaseKeyHigh = * (( __le64 * )( ParentLeaseKey + 8 ) );
1346+ memcpy ( buf -> lcontext .ParentLeaseKey , lease -> parent_lease_key ,
1347+ SMB2_LEASE_KEY_SIZE );
13511348 buf -> ccontext .DataOffset = cpu_to_le16 (offsetof
13521349 (struct create_lease_v2 , lcontext ));
13531350 buf -> ccontext .DataLength = cpu_to_le32 (sizeof (struct lease_context_v2 ));
@@ -1362,8 +1359,7 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
13621359 struct create_lease * buf = (struct create_lease * )rbuf ;
13631360
13641361 memset (buf , 0 , sizeof (struct create_lease ));
1365- buf -> lcontext .LeaseKeyLow = * ((__le64 * )LeaseKey );
1366- buf -> lcontext .LeaseKeyHigh = * ((__le64 * )(LeaseKey + 8 ));
1362+ memcpy (buf -> lcontext .LeaseKey , lease -> lease_key , SMB2_LEASE_KEY_SIZE );
13671363 buf -> lcontext .LeaseFlags = lease -> flags ;
13681364 buf -> lcontext .LeaseState = lease -> state ;
13691365 buf -> ccontext .DataOffset = cpu_to_le16 (offsetof
@@ -1416,19 +1412,17 @@ struct lease_ctx_info *parse_lease_state(void *open_req)
14161412 if (sizeof (struct lease_context_v2 ) == le32_to_cpu (cc -> DataLength )) {
14171413 struct create_lease_v2 * lc = (struct create_lease_v2 * )cc ;
14181414
1419- * ((__le64 * )lreq -> lease_key ) = lc -> lcontext .LeaseKeyLow ;
1420- * ((__le64 * )(lreq -> lease_key + 8 )) = lc -> lcontext .LeaseKeyHigh ;
1415+ memcpy (lreq -> lease_key , lc -> lcontext .LeaseKey , SMB2_LEASE_KEY_SIZE );
14211416 lreq -> req_state = lc -> lcontext .LeaseState ;
14221417 lreq -> flags = lc -> lcontext .LeaseFlags ;
14231418 lreq -> duration = lc -> lcontext .LeaseDuration ;
1424- * (( __le64 * ) lreq -> parent_lease_key ) = lc -> lcontext .ParentLeaseKeyLow ;
1425- * (( __le64 * )( lreq -> parent_lease_key + 8 )) = lc -> lcontext . ParentLeaseKeyHigh ;
1419+ memcpy ( lreq -> parent_lease_key , lc -> lcontext .ParentLeaseKey ,
1420+ SMB2_LEASE_KEY_SIZE ) ;
14261421 lreq -> version = 2 ;
14271422 } else {
14281423 struct create_lease * lc = (struct create_lease * )cc ;
14291424
1430- * ((__le64 * )lreq -> lease_key ) = lc -> lcontext .LeaseKeyLow ;
1431- * ((__le64 * )(lreq -> lease_key + 8 )) = lc -> lcontext .LeaseKeyHigh ;
1425+ memcpy (lreq -> lease_key , lc -> lcontext .LeaseKey , SMB2_LEASE_KEY_SIZE );
14321426 lreq -> req_state = lc -> lcontext .LeaseState ;
14331427 lreq -> flags = lc -> lcontext .LeaseFlags ;
14341428 lreq -> duration = lc -> lcontext .LeaseDuration ;
0 commit comments