Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Uninitialized Variable  at pvm_gstat.c:99

Categories: LANG.MEM.UVAR CWE:457
Warning ID: 2951.3034
Procedure: main
Trace: View
Modified: Wed Sep 2 12:54:30 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/pvm_gstat.c
   Enter main
 51 main(argc, argv) 
 52 int argc;
 53 char *argv[];
 54 {
 55     int gstid;
 56     int i, j, ng;  
 57     GROUP_STRUCT group;
 58         group.len = 0; group.name = (char *) NULL;
 59         group.tids = (int *) NULL; group.btids = (int *) NULL;
 60         pvm_mytid();
 61         if((gstid = gs_getgstid()) < 0)  
 62         {
 63             fprintf(stderr, "%s: no groups server\n", argv[0]);
 64             return(-1);
 65         }
 66         pvm_setcontext( SYSCTX_DG );
 67         pvm_initsend(PvmDataDefault);
 68         pvm_send(gstid, GSLS);
 69         if ( pvm_trecv(gstid, GSLS, pvmgs_tmout) <= 0)  
 70         {
 71              fprintf(stderr, "Error receiving message from group server\n");
 72              exit (-1);
 73         }
 74        
 75         /* Unpack the information for each group                           */ 
 76         pvm_upkint(&ng, 1, 1);
 77         if (ng == 0)   /* Uninitialized Variable (ID: 2953.3036) */
 78             fprintf(stdout, "no groups exist\n");
 79         for (i = 0; i < ng; i++)  
 80         {
 81             pvm_upkint(&(group.len),1,1);
 82             NEWMEM(group.name, group.len+1,char);
 83             pvm_upkstr(group.name);
 84             pvm_upkint(&(group.ntids), 1, 1);
 85             pvm_upkint(&(group.maxntids), 1,1);
 86             pvm_upkint(&(group.barrier_count), 1, 1);
 87             pvm_upkint(&(group.barrier_reached),1,1);
true88             NEWMEM(group.tids, group.maxntids, int);
 89             NEWMEM(group.btids, group.barrier_reached, int);
 90             pvm_upkint(group.tids, group.maxntids, 1);
 91             if (group.barrier_reached > 0)
 92                 pvm_upkint(group.btids, group.barrier_reached, 1);
 93             fprintf(stdout,  
 94                 "group: %s, size: %d,  barrier_count %d, barrier_reached %d\n",
 95                  group.name, group.ntids, group.barrier_count,  
 96                  group.barrier_reached);
 97             fputs("tids:\n", stdout);
 98             for (j = 0; j < group.maxntids; j++)
*group.tids is uninitialized99                 if (group.tids[j] > 0)     /* Uninitialized Variable */  /* Null Pointer Dereference (ID: 2952.3035) */
 100                     fprintf(stdout, "%d 0x%x\t", j, group.tids[j]);
 101             fputs("\n", stdout);
 102             if (group.barrier_reached > 0)  
 103             {
 104                 fputs("tids waiting on barrier:\n", stdout);
 105                 for (j = 0; j < group.barrier_reached; j++)
 106                      fprintf(stdout, "0x%x\t", group.btids[j]);   /* Uninitialized Variable (ID: 2950.3033) */
 107                 fputs("\n", stdout);
Preconditions
&$unknown_3698420 >= 1
&$unknown_3698422 >= 2
&$unknown_3698426 != 0
&$unknown_3698442 >= 1
pvmmytid >= -1
pvmtoplvl != 0
Postconditions
argc' = $param_1
argv' = $param_2
group.name' = 0
group.tids' = &$heap_254902
group.maxntids' >= 2
group.barrier_reached' = &$unknown_3698442
group.btids' = &$heap_254903
group.len' >= -1
gstid' >= 0
$heap_254902' is allocated by malloc
$heap_254902' is allocated
bytes_before(&$heap_254902)' = 0
bytes_after(&$heap_254903)' = 4 * &$unknown_3698442
$heap_254903' is allocated by malloc
$heap_254903' is allocated
bytes_before(&$heap_254903)' = 0
i' = &$unknown_3698422 - 1
ng' = &$unknown_3698422
pvmrbuf' = &$unknown_3698426
pvmtrc.trctid' >= 1
pvmtrccodef' = &$unknown_3698433




Change Warning 2951.3034 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: