Fix some Coverity issue

>>>     CID 1349726:  Incorrect expression  (COPY_PASTE_ERROR)
>>>     "tvb_reported_length_remaining" in "tvb_reported_length_remaining(tvb, offset)" looks like a copy-paste error.
>>>     CID 1349727:  Incorrect expression  (COPY_PASTE_ERROR)
>>>     "tree" in "dissector_try_uint_new(bluetooth_eir_ad_manufacturer_company_id, company_id, new_tvb, pinfo,
>>>     CID 1349728:    (DEADCODE)
>>>     Execution cannot reach this expression "0" inside statement "(0 && ((__s1_len = __builti...".
>>>     CID 1306904:  Logically dead code (DEADCODE)
>>>     Execution cannot reach this statement "tap_hci_summary->interface_...".

Change-Id: I5f99e37e6d5fac39da7082649caa8373d06bb808
Reviewed-on: https://code.wireshark.org/review/13739
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michal Labedzki 2016-01-21 09:23:42 +01:00 committed by Michael Mann
parent fb033d0f39
commit c09d894f74
4 changed files with 29 additions and 53 deletions

View File

@ -3235,13 +3235,9 @@ dissect_bthci_cmd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
if (bluetooth_data) {
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
} else {
tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
}
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_OPCODE;
tap_hci_summary->ogf = ogf;
@ -5483,7 +5479,7 @@ dissect_eir_ad_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bluetoo
new_tvb = tvb_new_subset_length(tvb, offset, length);
if (!dissector_try_uint_new(bluetooth_eir_ad_manufacturer_company_id, company_id, new_tvb, pinfo, tree, TRUE, bluetooth_eir_ad_data)) {
if (!dissector_try_uint_new(bluetooth_eir_ad_manufacturer_company_id, company_id, new_tvb, pinfo, entry_tree, TRUE, bluetooth_eir_ad_data)) {
sub_item = proto_tree_add_item(entry_tree, hf_btcommon_eir_ad_data, tvb, offset, length, ENC_NA);
expert_add_info(pinfo, sub_item, &ei_eir_ad_undecoded);
}

View File

@ -816,13 +816,9 @@ static void send_hci_summary_status_tap(guint8 status, packet_info *pinfo, bluet
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
if (bluetooth_data) {
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
} else {
tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
}
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_STATUS;
tap_hci_summary->status = status;
@ -840,13 +836,9 @@ static void send_hci_summary_pending_tap(packet_info *pinfo, bluetooth_data_t *b
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
if (bluetooth_data) {
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
} else {
tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
}
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_STATUS_PENDING;
tap_hci_summary->status = 0;
@ -861,13 +853,9 @@ static void send_hci_summary_reason_tap(guint8 reason, packet_info *pinfo, bluet
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
if (bluetooth_data) {
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
} else {
tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
}
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_REASON;
tap_hci_summary->reason = reason;
@ -1522,13 +1510,9 @@ dissect_bthci_evt_hardware_error(tvbuff_t *tvb, int offset, packet_info *pinfo,
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
if (bluetooth_data) {
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
} else {
tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
}
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_HARDWARE_ERROR;
tap_hci_summary->hardware_error = tvb_get_guint8(tvb, offset - 1);
@ -1712,13 +1696,9 @@ dissect_bthci_evt_command_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
if (bluetooth_data) {
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
} else {
tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
}
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT_OPCODE;
tap_hci_summary->ogf = ogf;
@ -4019,13 +3999,9 @@ dissect_bthci_evt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
bluetooth_hci_summary_tap_t *tap_hci_summary;
tap_hci_summary = wmem_new(wmem_packet_scope(), bluetooth_hci_summary_tap_t);
if (bluetooth_data) {
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
} else {
tap_hci_summary->interface_id = HCI_INTERFACE_DEFAULT;
tap_hci_summary->adapter_id = HCI_ADAPTER_DEFAULT;
}
tap_hci_summary->interface_id = bluetooth_data->interface_id;
tap_hci_summary->adapter_id = bluetooth_data->adapter_id;
tap_hci_summary->type = BLUETOOTH_HCI_SUMMARY_EVENT;
tap_hci_summary->event = evt_code;

View File

@ -389,10 +389,10 @@ dissect_btle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
else
interface_id = HCI_INTERFACE_DEFAULT;
if (bluetooth_data)
adapter_id = bluetooth_data->adapter_id;
else if (ubertooth_data)
if (ubertooth_data)
adapter_id = ubertooth_data->bus_id << 8 | ubertooth_data->device_address;
else if (bluetooth_data)
adapter_id = bluetooth_data->adapter_id;
else
adapter_id = HCI_ADAPTER_DEFAULT;

View File

@ -752,6 +752,7 @@ static int list_interfaces(const char *adb_server_ip, unsigned short *adb_server
char *data_str;
char pid[16];
memset(pid, 0, sizeof(pid));
response[data_length] = '\0';
data_str = strchr(response, '\n');
@ -828,6 +829,7 @@ static int list_interfaces(const char *adb_server_ip, unsigned short *adb_server
char *data_str;
char pid[16];
memset(pid, 0, sizeof(pid));
response[data_length] = '\0';
data_str = strchr(response, '\n');
@ -2377,6 +2379,8 @@ static int capture_android_wifi_tcpdump(char *interface, char *fifo,
}
}
}
closesocket(sock);
return 0;
}