New Defects reported by Coverity Scan for freerangerouting/frr
scan-admin at coverity.com
scan-admin at coverity.com
Thu Nov 9 00:21:37 UTC 2023
Hi,
Please find the latest report on new defect(s) introduced to freerangerouting/frr found with Coverity Scan.
4 new defect(s) introduced to freerangerouting/frr found with Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 4 of 4 defect(s)
** CID 1570951: Integer handling issues (BAD_SHIFT)
/mgmtd/mgmt_txn.c: 2344 in mgmt_txn_notify_be_adapter_conn()
________________________________________________________________________________________________________
*** CID 1570951: Integer handling issues (BAD_SHIFT)
/mgmtd/mgmt_txn.c: 2344 in mgmt_txn_notify_be_adapter_conn()
2338 * completed */
2339 if (txn->type == MGMTD_TXN_TYPE_CONFIG) {
2340 cmtcfg_req = txn->commit_cfg_req
2341 ? &txn->commit_cfg_req->req
2342 .commit_cfg
2343 : NULL;
>>> CID 1570951: Integer handling issues (BAD_SHIFT)
>>> In expression "1ULL << adapter->id", shifting by a negative amount has undefined behavior. The shift amount, "adapter->id", is as little as -1.
2344 if (cmtcfg_req && IS_IDBIT_SET(cmtcfg_req->clients,
2345 adapter->id)) {
2346 mgmt_txn_send_commit_cfg_reply(
2347 txn, MGMTD_INTERNAL_ERROR,
2348 "Backend daemon disconnected while processing commit!");
2349 }
** CID 1570950: Integer handling issues (BAD_SHIFT)
/mgmtd/mgmt_txn.c: 1344 in mgmt_txn_send_be_cfg_data()
________________________________________________________________________________________________________
*** CID 1570950: Integer handling issues (BAD_SHIFT)
/mgmtd/mgmt_txn.c: 1344 in mgmt_txn_send_be_cfg_data()
1338 struct mgmt_be_cfgreq cfg_req = { 0 };
1339 size_t num_batches, indx;
1340
1341 assert(txn->type == MGMTD_TXN_TYPE_CONFIG && txn->commit_cfg_req);
1342
1343 cmtcfg_req = &txn->commit_cfg_req->req.commit_cfg;
>>> CID 1570950: Integer handling issues (BAD_SHIFT)
>>> In expression "1ULL << adapter->id", shifting by a negative amount has undefined behavior. The shift amount, "adapter->id", is as little as -1.
1344 assert(IS_IDBIT_SET(cmtcfg_req->clients, adapter->id));
1345
1346 indx = 0;
1347 num_batches =
1348 mgmt_txn_batches_count(&cmtcfg_req->curr_batches[adapter->id]);
1349 FOREACH_TXN_CFG_BATCH_IN_LIST (&cmtcfg_req->curr_batches[adapter->id],
** CID 1570949: (BAD_SHIFT)
/mgmtd/mgmt_be_adapter.c: 168 in mgmt_register_client_xpath()
/mgmtd/mgmt_be_adapter.c: 161 in mgmt_register_client_xpath()
________________________________________________________________________________________________________
*** CID 1570949: (BAD_SHIFT)
/mgmtd/mgmt_be_adapter.c: 168 in mgmt_register_client_xpath()
162 return;
163 }
164 }
165 /* we didn't find a matching entry */
166 map = darr_append(*maps);
167 map->xpath_prefix = XSTRDUP(MTYPE_MGMTD_XPATH, xpath);
>>> CID 1570949: (BAD_SHIFT)
>>> In expression "1UL << id", shifting by a negative amount has undefined behavior. The shift amount, "id", is as little as -1.
168 map->clients = (1ul << id);
169 }
170
171 /*
172 * initial the combined maps from per client maps
173 */
/mgmtd/mgmt_be_adapter.c: 161 in mgmt_register_client_xpath()
155 struct mgmt_be_xpath_map **maps, *map;
156
157 maps = config ? &be_cfg_xpath_map : &be_oper_xpath_map;
158
159 darr_foreach_p (*maps, map) {
160 if (!strcmp(xpath, map->xpath_prefix)) {
>>> CID 1570949: (BAD_SHIFT)
>>> In expression "1U << id", shifting by a negative amount has undefined behavior. The shift amount, "id", is as little as -1.
161 map->clients |= (1u << id);
162 return;
163 }
164 }
165 /* we didn't find a matching entry */
166 map = darr_append(*maps);
** CID 1570948: Integer handling issues (BAD_SHIFT)
/mgmtd/mgmt_txn.c: 1397 in mgmt_txn_send_be_txn_delete()
________________________________________________________________________________________________________
*** CID 1570948: Integer handling issues (BAD_SHIFT)
/mgmtd/mgmt_txn.c: 1397 in mgmt_txn_send_be_txn_delete()
1391 struct mgmt_commit_cfg_req *cmtcfg_req =
1392 &txn->commit_cfg_req->req.commit_cfg;
1393
1394 assert(txn->type == MGMTD_TXN_TYPE_CONFIG);
1395 assert(!mgmt_txn_batches_count(&cmtcfg_req->curr_batches[adapter->id]));
1396
>>> CID 1570948: Integer handling issues (BAD_SHIFT)
>>> In expression "1ULL << adapter->id", shifting by a negative amount has undefined behavior. The shift amount, "adapter->id", is as little as -1.
1397 if (IS_IDBIT_UNSET(cmtcfg_req->clients, adapter->id))
1398 return 0;
1399
1400 return mgmt_be_send_txn_req(adapter, txn->txn_id, false);
1401 }
1402
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yrtN2DGUU98GYhjd55wXsXtw53zRK70R0agdV-2Fb7c45-2BoAJF92cCodBN9BBnDbw-2FFg-3D7vZX_O0IDF7c8sUs2B6kWTeWwAJZqriD5fgsfL8PAN30oQTy1Lx9ecHKT691UoHLnvFwl-2BvipsfX6viQRRM2eZhdvQz3m14GWBij09K4guC-2FuUmXK-2Fn14inwb-2F8zBy4Xkv7etOwKeGWWriGeAbfo7SpRHqpfnED78RKk5yg60Q-2BkxdARzUOZsL1mpIEiUj2M0kJRrCIjald6AFynSxjZN8y1SxA-3D-3D
More information about the dev
mailing list