@@ -1018,8 +1018,7 @@ static int ib_uverbs_create_comp_channel(struct uverbs_attr_bundle *attrs,
1018
1018
}
1019
1019
1020
1020
static struct ib_ucq_object * create_cq (struct uverbs_attr_bundle * attrs ,
1021
- struct ib_uverbs_ex_create_cq * cmd ,
1022
- size_t cmd_sz )
1021
+ struct ib_uverbs_ex_create_cq * cmd )
1023
1022
{
1024
1023
struct ib_ucq_object * obj ;
1025
1024
struct ib_uverbs_completion_event_file * ev_file = NULL ;
@@ -1053,9 +1052,7 @@ static struct ib_ucq_object *create_cq(struct uverbs_attr_bundle *attrs,
1053
1052
1054
1053
attr .cqe = cmd -> cqe ;
1055
1054
attr .comp_vector = cmd -> comp_vector ;
1056
-
1057
- if (cmd_sz > offsetof(typeof (* cmd ), flags ) + sizeof (cmd -> flags ))
1058
- attr .flags = cmd -> flags ;
1055
+ attr .flags = cmd -> flags ;
1059
1056
1060
1057
cq = ib_dev -> create_cq (ib_dev , & attr , obj -> uobject .context ,
1061
1058
& attrs -> driver_udata );
@@ -1120,9 +1117,7 @@ static int ib_uverbs_create_cq(struct uverbs_attr_bundle *attrs,
1120
1117
cmd_ex .comp_vector = cmd .comp_vector ;
1121
1118
cmd_ex .comp_channel = cmd .comp_channel ;
1122
1119
1123
- obj = create_cq (attrs , & cmd_ex ,
1124
- offsetof(typeof (cmd_ex ), comp_channel ) +
1125
- sizeof (cmd .comp_channel ));
1120
+ obj = create_cq (attrs , & cmd_ex );
1126
1121
return PTR_ERR_OR_ZERO (obj );
1127
1122
}
1128
1123
@@ -1143,7 +1138,7 @@ static int ib_uverbs_ex_create_cq(struct uverbs_attr_bundle *attrs,
1143
1138
if (cmd .reserved )
1144
1139
return - EINVAL ;
1145
1140
1146
- obj = create_cq (attrs , & cmd , min ( ucore -> inlen , sizeof ( cmd )) );
1141
+ obj = create_cq (attrs , & cmd );
1147
1142
return PTR_ERR_OR_ZERO (obj );
1148
1143
}
1149
1144
@@ -1309,7 +1304,7 @@ static int ib_uverbs_destroy_cq(struct uverbs_attr_bundle *attrs,
1309
1304
}
1310
1305
1311
1306
static int create_qp (struct uverbs_attr_bundle * attrs ,
1312
- struct ib_uverbs_ex_create_qp * cmd , size_t cmd_sz )
1307
+ struct ib_uverbs_ex_create_qp * cmd )
1313
1308
{
1314
1309
struct ib_uqp_object * obj ;
1315
1310
struct ib_device * device ;
@@ -1319,7 +1314,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
1319
1314
struct ib_cq * scq = NULL , * rcq = NULL ;
1320
1315
struct ib_srq * srq = NULL ;
1321
1316
struct ib_qp * qp ;
1322
- char * buf ;
1323
1317
struct ib_qp_init_attr attr = {};
1324
1318
struct ib_uverbs_ex_create_qp_resp resp ;
1325
1319
int ret ;
@@ -1338,9 +1332,7 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
1338
1332
obj -> uevent .uobject .user_handle = cmd -> user_handle ;
1339
1333
mutex_init (& obj -> mcast_lock );
1340
1334
1341
- if (cmd_sz >= offsetof(typeof (* cmd ), rwq_ind_tbl_handle ) +
1342
- sizeof (cmd -> rwq_ind_tbl_handle ) &&
1343
- (cmd -> comp_mask & IB_UVERBS_CREATE_QP_MASK_IND_TABLE )) {
1335
+ if (cmd -> comp_mask & IB_UVERBS_CREATE_QP_MASK_IND_TABLE ) {
1344
1336
ind_tbl = uobj_get_obj_read (rwq_ind_table ,
1345
1337
UVERBS_OBJECT_RWQ_IND_TBL ,
1346
1338
cmd -> rwq_ind_tbl_handle , attrs );
@@ -1438,10 +1430,7 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
1438
1430
INIT_LIST_HEAD (& obj -> uevent .event_list );
1439
1431
INIT_LIST_HEAD (& obj -> mcast_list );
1440
1432
1441
- if (cmd_sz >= offsetof(typeof (* cmd ), create_flags ) +
1442
- sizeof (cmd -> create_flags ))
1443
- attr .create_flags = cmd -> create_flags ;
1444
-
1433
+ attr .create_flags = cmd -> create_flags ;
1445
1434
if (attr .create_flags & ~(IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK |
1446
1435
IB_QP_CREATE_CROSS_CHANNEL |
1447
1436
IB_QP_CREATE_MANAGED_SEND |
@@ -1463,14 +1452,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
1463
1452
attr .source_qpn = cmd -> source_qpn ;
1464
1453
}
1465
1454
1466
- buf = (void * )cmd + sizeof (* cmd );
1467
- if (cmd_sz > sizeof (* cmd ))
1468
- if (!(buf [0 ] == 0 && !memcmp (buf , buf + 1 ,
1469
- cmd_sz - sizeof (* cmd ) - 1 ))) {
1470
- ret = - EINVAL ;
1471
- goto err_put ;
1472
- }
1473
-
1474
1455
if (cmd -> qp_type == IB_QPT_XRC_TGT )
1475
1456
qp = ib_create_qp (pd , & attr );
1476
1457
else
@@ -1594,8 +1575,7 @@ static int ib_uverbs_create_qp(struct uverbs_attr_bundle *attrs,
1594
1575
cmd_ex .qp_type = cmd .qp_type ;
1595
1576
cmd_ex .is_srq = cmd .is_srq ;
1596
1577
1597
- return create_qp (attrs , & cmd_ex ,
1598
- offsetof(typeof (cmd_ex ), is_srq ) + sizeof (cmd .is_srq ));
1578
+ return create_qp (attrs , & cmd_ex );
1599
1579
}
1600
1580
1601
1581
static int ib_uverbs_ex_create_qp (struct uverbs_attr_bundle * attrs ,
@@ -1614,7 +1594,7 @@ static int ib_uverbs_ex_create_qp(struct uverbs_attr_bundle *attrs,
1614
1594
if (cmd .reserved )
1615
1595
return - EINVAL ;
1616
1596
1617
- return create_qp (attrs , & cmd , min ( ucore -> inlen , sizeof ( cmd )) );
1597
+ return create_qp (attrs , & cmd );
1618
1598
}
1619
1599
1620
1600
static int ib_uverbs_open_qp (struct uverbs_attr_bundle * attrs ,
0 commit comments