Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at mac_lte_stat_dlg.c:320

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

mac_lte_stat_packet

(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/mac_lte_stat_dlg.c)expand/collapse
Show more  
 265  mac_lte_stat_packet(void *phs, packet_info *pinfo, epan_dissect_t *edt _U_,
 266                      const void *phi)
 267  {
 268      int n;
 269   
 270      /* Get reference to stat window instance */
 271      mac_lte_stat_t *hs = (mac_lte_stat_t *)phs;
 272      mac_lte_ep_t *tmp = NULL, *te = NULL;
 273   
 274      /* Cast tap info struct */
 275      struct mac_lte_tap_info *si = (struct mac_lte_tap_info *)phi;
 276   
 277      if (!hs) {
 278          return (0);
 279      }
 280   
 281      /* For common channels, just update global counters */
 282      switch (si->rntiType) {
 283          case P_RNTI:
 284              common_stats.pch_frames++;
 285              common_stats.pch_bytes += si->single_number_of_bytes;
 286              return 1;
 287          case SI_RNTI:
 288          case NO_RNTI:
 289              common_stats.bch_frames++;
 290              common_stats.bch_bytes += si->single_number_of_bytes;
 291              return 1;
 292          case RA_RNTI:
 293              common_stats.rar_frames++;
 294              common_stats.rar_entries += si->number_of_rars;
 295              return 1;
 296          case C_RNTI:
 297              /* Drop through for per-UE update */
 298              break;
 299   
 300          default:
 301              return 0;
 302      }
 303   
 304      /* For per-UE data, must create a new row if none already existing */
 305      if (!hs->ep_list) {
 306          /* Allocate new list */
 307          hs->ep_list = alloc_mac_lte_ep(si, pinfo);
 308          /* Make it the first/only entry */
 309          te = hs->ep_list;
 310      } else {
 311          /* Look among existing rows for this RNTI */
 312          for (tmp = hs->ep_list;(tmp != NULL); tmp = tmp->next) {
 313              if (tmp->stats.rnti == si->rnti) {
 314                  te = tmp;
 315                  break;
 316              }
 317          }
 318   
 319          /* Not found among existing, so create a new one anyway */
 320          if (te == NULL) {
 321              if ((te = alloc_mac_lte_ep(si, pinfo))) {
 322                  /* New item is head of list */
 323                  te->next = hs->ep_list;
 324                  hs->ep_list = te;
 325              }
 326          }
 327      }
 328   
 329      /* Really should have a row pointer by now */
 330      if (!te) {
 331          return 0;
 332      }
 333   
 334      /* Update entry with details from si */
 335      te->stats.rnti = si->rnti;
 336      te->stats.is_predefined_data = si->isPredefinedData;
 337      if (si->crcStatusValid && !si->crcStatus) {
 338          if (si->direction == DIRECTION_UPLINK) {
 339              te->stats.UL_CRC_errors++;
 340              return 1;
 341          }
 342          else {
 343              te->stats.DL_CRC_errors++;
 344              return 1;
 345          }
 346      }
 347   
 348      /* Uplink */
 349      if (si->direction == DIRECTION_UPLINK) {
 350          if (si->reTxCount >= 1) {
 351              te->stats.UL_retx_frames++;
 352              return 1;
 353          }
 354          te->stats.UL_frames++;
 355   
 356          if (si->isPredefinedData) {
 357              te->stats.UL_total_bytes += si->single_number_of_bytes;
 358          }
 359          else {
 360              for (n=0; n < 11; n++) {
 361                  if (si->bytes_for_lcid[n]) {
 362                      te->stats.UL_sdus_for_lcid[n] += si->sdus_for_lcid[n];
 363                  }
 364                  te->stats.UL_bytes_for_lcid[n] += si->bytes_for_lcid[n];
 365                  te->stats.UL_total_bytes += si->bytes_for_lcid[n];
 366              }
 367          }
 368      }
 369   
 370      /* Downlink */
 371      else {
 372          if (si->reTxCount >= 1) {
 373              te->stats.DL_retx_frames++;
 374              return 1;
 375          }
 376   
 377          te->stats.DL_frames++;
 378   
 379          if (si->isPredefinedData) {
 380              te->stats.DL_total_bytes += si->single_number_of_bytes;
 381          }
 382          else {
 383              for (n=0; n < 11; n++) {
 384                  if (si->bytes_for_lcid[n]) {
 385                      te->stats.DL_sdus_for_lcid[n] += si->sdus_for_lcid[n];
 386                  }
 387                  te->stats.DL_bytes_for_lcid[n] += si->bytes_for_lcid[n];
 388                  te->stats.DL_total_bytes += si->bytes_for_lcid[n];
 389              }
 390          }
 391      }
 392   
 393      return 1;
 394  }
Show more  




Change Warning 12260.29712 : Null Test After Dereference

Priority:
State:
Finding:
Owner:
Note: