Text   |  XML   |  ReML   |   Visible Warnings:

Redundant Condition  at emem.c:960

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

emem_tree_lookup32_le

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/emem.c)expand/collapse
Show more  
 936  void *
 937  emem_tree_lookup32_le(emem_tree_t *se_tree, guint32 key)
 938  {
 939          emem_tree_node_t *node;
 940   
 941          node=se_tree->tree;
 942   
 943          if(!node){
 944                  return NULL;
 945          }
 946   
 947   
 948          while(node){
 949                  if(key==node->key32){
 950                          return node->data;
 951                  }
 952                  if(key<node->key32){
 953                          if(node->left){
 954                                  node=node->left;
 955                                  continue;
 956                          } else {
 957                                  break;
 958                          }
 959                  }
 960                  if(key>node->key32){
 961                          if(node->right){
 962                                  node=node->right;
 963                                  continue;
 964                          } else {
 965                                  break;
 966                          }
 967                  }
 968          }
 969   
 970   
 971          /* If we are still at the root of the tree this means that this node 
 972           * is either smaller than the search key and then we return this
 973           * node or else there is no smaller key available and then 
 974           * we return NULL.
 975           */
 976          if(!node->parent){
 977                  if(key>node->key32){
 978                          return node->data;
 979                  } else {
 980                          return NULL;
 981                  }
 982          }
 983   
 984          if(node->parent->left==node){
 985                  /* left child */
 986   
 987                  if(key>node->key32){
 988                          /* if this is a left child and its key is smaller than
 989                           * the search key, then this is the node we want.
 990                           */
 991                          return node->data;
 992                  } else {
 993                          /* if this is a left child and its key is bigger than
 994                           * the search key, we have to check if any
 995                           * of our ancestors are smaller than the search key.
 996                           */
 997                          while(node){
 998                                  if(key>node->key32){
 999                                          return node->data;
 1000                                  }
 1001                                  node=node->parent;
 1002                          }
 1003                          return NULL;
 1004                  }
 1005          } else {
 1006                  /* right child */
 1007   
 1008                  if(node->key32<key){
 1009                          /* if this is the right child and its key is smaller 
 1010                           * than the search key then this is the one we want.
 1011                           */
 1012                          return node->data;
 1013                  } else {
 1014                          /* if this is the right child and its key is larger 
 1015                           * than the search key then our parent is the one we 
 1016                           * want.
 1017                           */
 1018                          return node->parent->data;
 1019                  }
 1020          }
 1021   
 1022  }
Show more  




Change Warning 1954.29263 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: