From e57b37137d3b609dfad486d443b038453512e792 Mon Sep 17 00:00:00 2001 From: Roman Koshelev Date: Sat, 11 Jan 2020 18:39:42 +0300 Subject: Compilation fixes when CMAKE_BUILD_TYPE = MinSizeRel (-Os flag). Compiler - gcc 8.3.0 These are mostly errors 'may be used uninitialized in this function' Change-Id: I6a8f7172c99024fd449570937b030e37c0ea5c3d Reviewed-on: https://code.wireshark.org/review/35746 Reviewed-by: Pascal Quantin --- epan/dissectors/asn1/nbap/nbap.cnf | 2 +- epan/dissectors/packet-cdp.c | 2 +- epan/dissectors/packet-gmr1_rach.c | 2 ++ epan/dissectors/packet-nbap.c | 2 +- epan/dissectors/packet-rpcrdma.c | 8 +++++--- epan/dissectors/packet-rsl.c | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/epan/dissectors/asn1/nbap/nbap.cnf b/epan/dissectors/asn1/nbap/nbap.cnf index 147645c018..a00a9b27a9 100644 --- a/epan/dissectors/asn1/nbap/nbap.cnf +++ b/epan/dissectors/asn1/nbap/nbap.cnf @@ -583,7 +583,7 @@ actx->pinfo->link_dir=P2P_DIR_UL; guint32 total_bit_size = 0; guint32 total_byte_size = 0; nbap_ib_segment_t* nbap_ib_segment; - wmem_list_t *list; + wmem_list_t *list = NULL; wmem_list_frame_t *curr_frame; guint8 *final_arr; guint8 final_byte_off = 0; diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c index 3e7f115221..14dcead36e 100644 --- a/epan/dissectors/packet-cdp.c +++ b/epan/dissectors/packet-cdp.c @@ -1049,7 +1049,7 @@ dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree) proto_tree *address_tree; guint8 protocol_type; guint8 protocol_length; - int nlpid; + int nlpid = 0; guint16 address_length; guint16 etypeid = 0; int hf_addr = -1; diff --git a/epan/dissectors/packet-gmr1_rach.c b/epan/dissectors/packet-gmr1_rach.c index ab6ac1a64a..3347d5c158 100644 --- a/epan/dissectors/packet-gmr1_rach.c +++ b/epan/dissectors/packet-gmr1_rach.c @@ -866,6 +866,8 @@ dissect_gmr1_rach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat proto_tree *rach_tree; const char *desc; int len, is_moc, is_pdt, ies; + is_moc = 0; + is_pdt = 0; len = tvb_reported_length(tvb); diff --git a/epan/dissectors/packet-nbap.c b/epan/dissectors/packet-nbap.c index b25fa6544f..3060696ef7 100644 --- a/epan/dissectors/packet-nbap.c +++ b/epan/dissectors/packet-nbap.c @@ -26664,7 +26664,7 @@ dissect_nbap_IB_SG_DATA(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, guint32 total_bit_size = 0; guint32 total_byte_size = 0; nbap_ib_segment_t* nbap_ib_segment; - wmem_list_t *list; + wmem_list_t *list = NULL; wmem_list_frame_t *curr_frame; guint8 *final_arr; guint8 final_byte_off = 0; diff --git a/epan/dissectors/packet-rpcrdma.c b/epan/dissectors/packet-rpcrdma.c index f259bbb523..747d7c769f 100644 --- a/epan/dissectors/packet-rpcrdma.c +++ b/epan/dissectors/packet-rpcrdma.c @@ -324,7 +324,7 @@ static gint32 get_msg_num(guint32 psn, guint32 frag_size, guint32 i, epsn, nfrags; request_t *p_request; wmem_list_frame_t *item; - segment_info_t *p_segment_info; + segment_info_t *p_segment_info = NULL; guint32 iosize = p_rdma_conv_info->iosize; /* Look for the segment where the PSN for this packet belongs to */ @@ -413,7 +413,7 @@ static gboolean is_reassembly_done(rdma_conv_info_t *p_rdma_conv_info, guint32 m guint32 reassembled_size = 0; wmem_list_frame_t *item; request_t *p_request; - segment_info_t *p_segment_info; + segment_info_t *p_segment_info = NULL; gboolean ret = FALSE; /* Make sure there is at least one segment */ /* Check all segments for the given reassembly message id */ @@ -1325,7 +1325,7 @@ dissect_rpcrdma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data tvbuff_t *frag_tvb; proto_item *ti; proto_tree *rpcordma_tree; - guint offset = 0; + guint offset; guint32 msg_type = 0; guint32 xid; guint32 val; @@ -1339,6 +1339,7 @@ dissect_rpcrdma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data this is an rpcrdma packet */ if (tvb_captured_length(tvb) < 8) return 0; + if (tvb_get_ntohl(tvb, 4) != 1) /* vers */ return 0; @@ -1352,6 +1353,7 @@ dissect_rpcrdma(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data rpcordma_tree = proto_item_add_subtree(ti, ett_rpcordma); + offset = 0; proto_tree_add_item(rpcordma_tree, hf_rpcordma_xid, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; diff --git a/epan/dissectors/packet-rsl.c b/epan/dissectors/packet-rsl.c index 7838598d5f..2d1a91c524 100644 --- a/epan/dissectors/packet-rsl.c +++ b/epan/dissectors/packet-rsl.c @@ -3578,7 +3578,7 @@ dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int unsigned int len, hlen; const struct tlv_def *tdef; proto_item *ti; - proto_tree *ie_tree; + proto_tree *ie_tree = NULL; tag = tvb_get_guint8(tvb, offset); tdef = &rsl_att_tlvdef.def[tag]; -- cgit v1.2.3