Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Uninitialized Variable  at pvmgs_func.c:136

Categories: LANG.MEM.UVAR CWE:457
Warning ID: 2936.3019
Procedure: gs_struct_init
Trace: View
Modified: Wed Sep 2 12:53:17 2009   show details
 
Priority: None
State: None
Finding: None
Owner: None
  edit properties

Legend [ X ]
Warning Location
Contributes
Parse Error
Other Warning
Two or More Loop Iterations
On Execution Path
Comment
Macro
Preprocessor
Include
Keyword
Preprocessed Away

Source  |  Language: C Hide Legend     
ProblemLineSource
   /u1/paul/SATE/2010/c/pvm/pvm3/pvmgs/pvmgsu_core.c
   Enter gs_cachegroup
 792 gs_cachegroup(sgroup_list, ngroups, rsgroup) 
 793 GROUP_LIST_PTR sgroup_list;
 794 int *ngroups;
 795 GROUP_STRUCT_PTR *rsgroup;
 796 {
 797         char *newname = (char *) NULL;  
 798  
 799         int info;
 800         int len;
 801  
 802         GROUP_STRUCT_PTR sgroup;  
 803  
 804         *rsgroup = (GROUP_STRUCT_PTR) NULL;
 805  
 806         if ( (info = pvm_upkint(&len,1,1))  < 0 )
 807                 DO_ERROR_RTN( info, "gs_cachegroup" );
 808  
 809         if (len < 0)                  /* didn't get a valid groupname     */   /* Uninitialized Variable (ID: 2939.3022) */
 810                 return(-1);
 811  
 812         if ( (newname = (char *) PVM_ALLOC(sizeof(char)*(len + 1),
true813                         "gs_cachegroup") ) == (char *) NULL)  
 814                 DO_ERROR_RTN( PvmNoMem, "gs_cachegroup" );
 815  
 816         if ( (info = pvm_upkstr(newname))  < 0  )
 817         {
 818                 PVM_FREE(newname);
 819                 DO_ERROR_RTN( info, "gs_cachegroup" );
 820         }
 821  
*newname is uninitialized822         sgroup = gs_group(newname, sgroup_list, ngroups, CREATE);
     /u1/paul/SATE/2010/c/pvm/pvm3/pvmgs/pvmgs_func.c
     Enter gs_cachegroup / gs_group
*$param_1 is uninitialized375   gs_group(groupname, hash_list, ngroups, create) 
 376   char *groupname;
 377   GROUP_LIST_PTR hash_list;
 378   int *ngroups;
 379   int create;
 380   {
 381    
 382           GROUP_LIST_PTR listentry;
 383    
*groupname is uninitialized384           listentry = gs_hash_name(groupname, hash_list, ngroups, create);
       Enter gs_cachegroup / gs_group / gs_hash_name
*$param_1 is uninitialized255     gs_hash_name(name, hash_list, ngroups, create) 
 256     char *name;
 257     GROUP_LIST_PTR hash_list;
 258     int *ngroups;
 259     int create;
 260     {
 261             char *key;
 262      
 263             int hash_index;
 264             int len = 0;
 265             int match;  
 266             int relation;
 267             int sum = 0;  
 268      
 269             GROUP_LIST_PTR current;
 270             GROUP_LIST_PTR listentry;
 271             GROUP_LIST_PTR prev;
 272      
 273             GROUP_STRUCT_PTR group;
 274      
 275             if (name == (char *) NULL || *name == '\0')    /* Uninitialized Variable (ID: 2938.3021) */
 276                     return( (GROUP_LIST_PTR) NULL);  /* Null group name error      */ 
 277      
 278             /* The following is the hash algorithm.                            */ 
 279             key = name;  
 280             while (*key != '\0')  /* sum all the characters in the string      */    /* Uninitialized Variable (ID: 2937.3020) */
 281             {    
 282                     sum += INTERVAL(MINCHAR, *key, MAXCHAR);
 283                     key++;
 284                     len++;
 285             }
 286      
 287             hash_index = sum/len;
 288             hash_index = hash_index - MINCHAR;
 289        
 290             /* hash into the table and then do a linear search for the name    */ 
 291             /* if there is a collision                                         */ 
 292             /* names are kept in lexicographic order                           */ 
 293      
 294             prev = hash_list + hash_index;
 295             current = prev->next;
 296             listentry = (GROUP_LIST_PTR) NULL;
 297      
 298             while (current != (GROUP_LIST_PTR) NULL )
 299             {
 300                     relation = strncmp(name, current->group->name,  
 301                                     MAX(current->group->len,len));    
 302      
 303                     if ( relation == 0 )  /* strings are exactly equal             */ 
 304                     {
 305                             listentry = current;
 306                             break; /* found the group name                             */ 
 307                     }
 308      
 309                     if (relation < 0)  
 310                             break; /* group name does not exist                        */ 
 311      
 312                     prev = current;             /* go to next entry in linked list */ 
 313      
 314                     current = current->next;
 315             }
 316      
 317             if (create != CREATE || listentry != (GROUP_LIST_PTR) NULL)  
 318                     return listentry;  /*return what we found, if anything         */ 
 319      
 320             /* we didn't find the group, but have been asked to create it      */ 
 321      
*name is uninitialized322             if ( (group = gs_struct_init(name)) == (GROUP_STRUCT_PTR) NULL)   /* Leak (ID: 2935.3017) */
         Enter gs_cachegroup / gs_group / gs_hash_name / gs_struct_init
*$param_1 is uninitialized125       gs_struct_init(groupname) 
 126       char *groupname;
 127       {
 128        
 129               GROUP_STRUCT_PTR rvalue;
 130        
 131               if ( (rvalue = (GROUP_STRUCT_PTR)PVM_ALLOC(sizeof(GROUP_STRUCT), GSNAME)) 
 132                               ==  (GROUP_STRUCT_PTR) NULL)  
 133                       return (rvalue);    /* Out of resources                         */ 
 134        
 135               if ( (rvalue->name = 
*groupname is uninitialized136                                       (char *) PVM_ALLOC(sizeof(char)*(strlen(groupname)+1), GSNAME))     /* Uninitialized Variable */
         Exit gs_cachegroup / gs_group / gs_hash_name / gs_struct_init
       Exit gs_cachegroup / gs_group / gs_hash_name
     Exit gs_cachegroup / gs_group
Preconditions
((char*)$param_1)[8] = 0
$heap_242574 != 0
$heap_242574 <= 31
strlen(&$heap_242574) = 1
((char*)&$heap_242574)[1] = 0
pvmrbuf != 0
pvmtoplvl != 0
pvmtrc.trctid != pvmmytid
pvmtrc.trctid >= 1
Postconditions
create' = 1
create' = 1
current' = ((char*)$param_1)[8]
groupname' = &$heap_242574
groupname' = &$heap_242574
hash_index' = 0
hash_list' = $param_1
hash_list' = $param_1
$heap_242574' is allocated by malloc
$heap_242574' is allocated
bytes_before(&$heap_242574)' = 0
bytes_after(&$heap_242575)' = 128
$heap_242575' is allocated by malloc
$heap_242575' is allocated
bytes_before(&$heap_242575)' = 0
info' >= 0
key' = &$heap_242574 + 1
len' >= 0
len' = 1
listentry' = 0
name' = &$heap_242574
newname' = &$heap_242574
ngroups' = $param_2
ngroups' = $param_2
ngroups' = $param_2
prev' = $param_1
rsgroup' = $param_3
rvalue' = &$heap_242575
sgroup_list' = $param_1
sum' = 32




Change Warning 2936.3019 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: