Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/bluetooth/hci/ng_hci_evnt.c
Show First 20 Lines • Show All 377 Lines • ▼ Show 20 Lines | |||||
le_advertizing_report(ng_hci_unit_p unit, struct mbuf *event) | le_advertizing_report(ng_hci_unit_p unit, struct mbuf *event) | ||||
{ | { | ||||
ng_hci_le_advertising_report_ep *ep = NULL; | ng_hci_le_advertising_report_ep *ep = NULL; | ||||
ng_hci_neighbor_p n = NULL; | ng_hci_neighbor_p n = NULL; | ||||
bdaddr_t bdaddr; | bdaddr_t bdaddr; | ||||
int error = 0; | int error = 0; | ||||
u_int8_t event_type; | u_int8_t event_type; | ||||
u_int8_t addr_type; | u_int8_t addr_type; | ||||
u_int8_t num_reports; | |||||
NG_HCI_M_PULLUP(event, sizeof(*ep)); | NG_HCI_M_PULLUP(event, sizeof(*ep)); | ||||
if (event == NULL) | if (event == NULL) | ||||
return (ENOBUFS); | return (ENOBUFS); | ||||
ep = mtod(event, ng_hci_le_advertising_report_ep *); | ep = mtod(event, ng_hci_le_advertising_report_ep *); | ||||
m_adj(event, sizeof(*ep)); | m_adj(event, sizeof(*ep)); | ||||
for (; ep->num_reports > 0; ep->num_reports --) { | num_reports = ep->num_reports; | ||||
for (; num_reports > 0; num_reports --) { | |||||
donner: This original loop modifies the record field "num_reports" directly inside the netgraph data. | |||||
/* Get remote unit address */ | /* Get remote unit address */ | ||||
NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); | NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); | ||||
if (event == NULL) { | |||||
NG_HCI_WARN("%s: Get event type failed\n", __func__); | |||||
donnerUnsubmitted Not Done Inline ActionsThe error message is very generic and not helpful for the end user. donner: The error message is very generic and not helpful for the end user.
It looks more like a… | |||||
goto out; | |||||
} | |||||
event_type = *mtod(event, u_int8_t *); | event_type = *mtod(event, u_int8_t *); | ||||
m_adj(event, sizeof(u_int8_t)); | m_adj(event, sizeof(u_int8_t)); | ||||
NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); | NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); | ||||
if (event == NULL) { | |||||
NG_HCI_WARN("%s: Get addr type failed\n", __func__); | |||||
goto out; | |||||
} | |||||
addr_type = *mtod(event, u_int8_t *); | addr_type = *mtod(event, u_int8_t *); | ||||
m_adj(event, sizeof(u_int8_t)); | m_adj(event, sizeof(u_int8_t)); | ||||
m_copydata(event, 0, sizeof(bdaddr), (caddr_t) &bdaddr); | m_copydata(event, 0, sizeof(bdaddr), (caddr_t) &bdaddr); | ||||
m_adj(event, sizeof(bdaddr)); | m_adj(event, sizeof(bdaddr)); | ||||
/* Lookup entry in the cache */ | /* Lookup entry in the cache */ | ||||
n = ng_hci_get_neighbor(unit, &bdaddr, (addr_type) ? NG_HCI_LINK_LE_RANDOM:NG_HCI_LINK_LE_PUBLIC); | n = ng_hci_get_neighbor(unit, &bdaddr, (addr_type) ? NG_HCI_LINK_LE_RANDOM:NG_HCI_LINK_LE_PUBLIC); | ||||
▲ Show 20 Lines • Show All 985 Lines • Show Last 20 Lines |
This original loop modifies the record field "num_reports" directly inside the netgraph data.
After this modification, only a temporary variable is modified, but the result is not stored back.
So the modification is not semantically equivalent.
Please explain, why this change in functionality is allowed in this context.