Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at packet-scsi-osd.c:2618

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

dissect_osd_opcode

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-scsi-osd.c)expand/collapse
Show more  
 2574  dissect_osd_opcode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
 2575                          guint offset, gboolean isreq, gboolean iscdb,
 2576                          guint payload_len, scsi_task_data_t *cdata)
 2577  {
 2578          guint16 svcaction=0;
 2579          scsi_osd_dissector_t dissector;
 2580          scsi_osd_conv_info_t *conv_info=NULL;
 2581          scsi_osd_lun_info_t *lun_info=NULL;
 2582   
 2583          if(!tree) {
 2584                  return;
 2585          }
 2586   
 2587          /* We must have an itl an itlq and a conversation */
 2588          if(!cdata || !cdata->itl || !cdata->itl->conversation || !cdata->itlq){
 2589                  return;
 2590          }
 2591          /* make sure we have a conversation info for this */
 2592          conv_info=conversation_get_proto_data(cdata->itl->conversation, proto_scsi_osd);
 2593          if(!conv_info){
 2594                  conv_info=se_alloc(sizeof(scsi_osd_conv_info_t));
 2595                  conv_info->luns=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SCSI OSD luns tree");
 2596                  conversation_add_proto_data(cdata->itl->conversation, proto_scsi_osd, conv_info);
 2597          }
 2598          /* make sure we have a lun_info structure for this */
 2599          lun_info=se_tree_lookup32(conv_info->luns, cdata->itlq->lun);
 2600          if(!lun_info){
 2601                  lun_info=se_alloc(sizeof(scsi_osd_lun_info_t));
 2602                  lun_info->partitions=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "SCSI OSD partitions tree");
 2603                  se_tree_insert32(conv_info->luns, cdata->itlq->lun, (void *)lun_info);
 2604          }
 2605   
 2606          /* dissecting the CDB */
 2607          if (isreq && iscdb) {
 2608                  proto_tree_add_item (tree, hf_scsi_control, tvb, offset, 1, 0);
 2609                  offset++;
 2610   
 2611                  /* 5 reserved bytes */
 2612                  offset+=5;
 2613   
 2614                  proto_tree_add_item (tree, hf_scsi_osd_add_cdblen, tvb, offset, 1, 0);
 2615                  offset++;
 2616   
 2617                  svcaction=tvb_get_ntohs(tvb, offset);
 2618                  if(cdata && cdata->itlq){
 2619                          /* We must store the service action for this itlq 
 2620                           * so we can indentify what the data contains
 2621                           */
 2622                          if((!pinfo->fd->flags.visited) && (!cdata->itlq->extra_data)){
 2623                                  scsi_osd_extra_data_t *extra_data;
 2624   
 2625                                  extra_data=se_alloc(sizeof(scsi_osd_extra_data_t));
 2626                                  extra_data->svcaction=svcaction;
 2627                                  extra_data->gsatype=0;
 2628                                  cdata->itlq->extra_data=extra_data;
 2629                          }
 2630                  }
 2631                  proto_tree_add_item (tree, hf_scsi_osd_svcaction, tvb, offset, 2, 0);
 2632                  offset+=2;
 2633   
 2634   
 2635                  if(check_col(pinfo->cinfo, COL_INFO)){
 2636                          col_append_str(pinfo->cinfo, COL_INFO,  
 2637                                  val_to_str(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction"));
 2638                  }
 2639                  dissector=find_svcaction_dissector(svcaction);
 2640                  if(dissector){
 2641                          (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata, conv_info, lun_info);
 2642                  }
 2643                  return;
 2644          }
 2645   
 2646          /* If it was not a CDB, try to find the service action and pass it 
 2647           * off to the service action dissector
 2648           */
 2649          if(cdata && cdata->itlq && cdata->itlq->extra_data){
 2650                  scsi_osd_extra_data_t *extra_data=cdata->itlq->extra_data;
 2651                  svcaction=extra_data->svcaction;
 2652          }
 2653          if(check_col(pinfo->cinfo, COL_INFO)){
 2654                  col_append_str(pinfo->cinfo, COL_INFO,  
 2655                          val_to_str(svcaction, scsi_osd_svcaction_vals, "Unknown OSD Serviceaction"));
 2656          }
 2657          if(svcaction){
 2658                  proto_item *it;
 2659                  it=proto_tree_add_uint_format(tree, hf_scsi_osd_svcaction, tvb, 0, 0, svcaction, "Service Action: 0x%04x", svcaction);
 2660                  PROTO_ITEM_SET_GENERATED(it);
 2661          }
 2662          dissector=find_svcaction_dissector(svcaction);
 2663          if(dissector){
 2664                  (*dissector)(tvb, pinfo, tree, offset, isreq, iscdb, payload_len, cdata, conv_info, lun_info);
 2665          }
 2666   
 2667  }
Show more  




Change Warning 1262.32271 : Null Test After Dereference

Because they are very similar, this warning shares annotations with warning 1262.32272.

Priority:
State:
Finding:
Owner:
Note: