ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] About Dead Store in clang Analysis

From: Alexis La Goutte <alexis.lagoutte@xxxxxxxxx>
Date: Thu, 24 Mar 2011 20:56:26 +0100
Hi,

I take a look in Clang Analysis report ( http://www.wireshark.org/download/automated/analysis/ ).

And there is a lot of  Dead increment

Example : in the packet-ieee80211.c

6390    case TAG_POWER_CONSTRAINT: /* 7.3.2.15 Power Constraint element (32) */
6391    {
6392      if (tag_len != 1)
6393      {
6394        expert_add_info_format(pinfo, ti_len, PI_MALFORMED, PI_ERROR, "Tag Length %u wrong, must be = 1", tag_len);
6395        break;
6396      }
6397      offset += 2;
6398  
6399      proto_tree_add_item(tree, hf_ieee80211_tag_power_constraint_local, tvb, offset, 1, TRUE);
6400      proto_item_append_text(ti, " :%d", tvb_get_guint8(tvb, offset));
6401      offset += 1;
Value stored to 'offset' is never read
6402      
6403      break;
6404    } 


What it the official solution to fix this ?
1) Remove the code 
2) Ignore this warning 
3) Comment the code  add a 
 /*     offset += 1;  Remove Clang Dead increment */

Regards;