@@ -1335,19 +1335,16 @@ __u8 smb2_map_lease_to_oplock(__le32 lease_state)
1335
1335
*/
1336
1336
void create_lease_buf (u8 * rbuf , struct lease * lease )
1337
1337
{
1338
- char * LeaseKey = (char * )& lease -> lease_key ;
1339
-
1340
1338
if (lease -> version == 2 ) {
1341
1339
struct create_lease_v2 * buf = (struct create_lease_v2 * )rbuf ;
1342
- char * ParentLeaseKey = (char * )& lease -> parent_lease_key ;
1343
1340
1344
1341
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 );
1347
1344
buf -> lcontext .LeaseFlags = lease -> flags ;
1348
1345
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 );
1351
1348
buf -> ccontext .DataOffset = cpu_to_le16 (offsetof
1352
1349
(struct create_lease_v2 , lcontext ));
1353
1350
buf -> ccontext .DataLength = cpu_to_le32 (sizeof (struct lease_context_v2 ));
@@ -1362,8 +1359,7 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
1362
1359
struct create_lease * buf = (struct create_lease * )rbuf ;
1363
1360
1364
1361
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 );
1367
1363
buf -> lcontext .LeaseFlags = lease -> flags ;
1368
1364
buf -> lcontext .LeaseState = lease -> state ;
1369
1365
buf -> ccontext .DataOffset = cpu_to_le16 (offsetof
@@ -1416,19 +1412,17 @@ struct lease_ctx_info *parse_lease_state(void *open_req)
1416
1412
if (sizeof (struct lease_context_v2 ) == le32_to_cpu (cc -> DataLength )) {
1417
1413
struct create_lease_v2 * lc = (struct create_lease_v2 * )cc ;
1418
1414
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 );
1421
1416
lreq -> req_state = lc -> lcontext .LeaseState ;
1422
1417
lreq -> flags = lc -> lcontext .LeaseFlags ;
1423
1418
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 ) ;
1426
1421
lreq -> version = 2 ;
1427
1422
} else {
1428
1423
struct create_lease * lc = (struct create_lease * )cc ;
1429
1424
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 );
1432
1426
lreq -> req_state = lc -> lcontext .LeaseState ;
1433
1427
lreq -> flags = lc -> lcontext .LeaseFlags ;
1434
1428
lreq -> duration = lc -> lcontext .LeaseDuration ;
0 commit comments