Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Uninitialized Variable  at trcutil.c:441

Categories: LANG.MEM.UVAR CWE:457
Warning ID: 484.29258
Procedure: trc_print_tmask
Trace: view
Modified: Thu Nov 26 11:36:29 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
   /kat0/fletcher/SATE/2010/pvm3/console/cmds.c
   Enter printtm
true2525 printtm(who) 
 2526         int who;
 2527 {
 2528         Pvmtmask tm;
 2529  
 2530         pvm_gettmask(who, tm);
 2531  
tm is uninitialized2532         trc_print_tmask(tm);
     /kat0/fletcher/SATE/2010/pvm3/tracer/trcutil.c
     Enter printtm / trc_print_tmask
 349   trc_print_tmask( tmask ) 
 350   Pvmtmask tmask;
 351   {
 352           static int indices[ TEV_MAX + 1 ];
 353    
 354           static int ncols = -1;
 355           static int nrows = -1;
 356           static int ntev = -1;
 357    
 358           static char fmt[64];
 359    
 360           int i, j, k;
 361           int maxlen;
 362           int width;
 363           int index;
 364           int flag;
 365           int len;
 366           int b;
 367           int c;
 368           int x;
 369    
 370           if ( ntev == -1 )
 371           {
 372                   maxlen = -1;
 373    
 374                   x = 0;
 375    
 376                   for ( i=TEV_FIRST ; i <= TEV_MAX ; i++ )
 377                   {
 378                           /* Skip Internal Events */ 
 379    
 380                           if ( strcmp( pvmtevinfo[i].name, "newtask" ) 
 381                                   && strcmp( pvmtevinfo[i].name, "spntask" ) 
 382                                   && strcmp( pvmtevinfo[i].name, "endtask" ) 
 383                                   && strcmp( pvmtevinfo[i].name, "timing" ) 
 384                                   && strcmp( pvmtevinfo[i].name, "profiling" ) )
 385                           {
 386                                   /* Determine Max Name Length */ 
 387    
 388                                   len = strlen( pvmtevinfo[i].name );
 389    
 390                                   if ( len > maxlen || maxlen == -1 )
 391                                           maxlen = len;
 392    
 393                                   /* Sort 'Em Ugly Like */ 
 394    
 395                                   flag = 0;
 396    
 397                                   for ( j=0 ; j < x && !flag ; j++ )
 398                                   {
 399                                           if ( strcmp( pvmtevinfo[i].name,
 400                                                   pvmtevinfo[ indices[j] ].name ) < 0 )
 401                                           {
 402                                                   for ( k=x+1 ; k > j ; k-- )
 403                                                           indices[k] = indices[k - 1];
 404    
 405                                                   indices[j] = i;
 406    
 407                                                   x++;
 408    
 409                                                   flag++;
 410                                           }
 411                                   }
 412    
 413                                   if ( !flag )
 414                                           indices[x++] = i;
 415                           }
 416                   }
 417    
 418                   ntev = x;
 419    
 420                   maxlen += 4;
 421    
 422                   ncols = 79 / maxlen;
 423    
 424                   width = (79 / ncols) - 4;
 425    
 426                   sprintf( fmt, " %%c %%-%ds%%c", width );
 427    
 428                   nrows = ( ntev + ncols - 1 ) / ncols;
 429           }
 430    
 431           for ( i=0 ; i < nrows ; i++ )
 432           {
 433                   for ( c=0 ; c < ncols ; c++ )
 434                   {
 435                           index = i + (c * nrows);
 436    
 437                           if ( index < ntev )
 438                           {
 439                                   x = indices[ index ];
 440    
*tmask is uninitialized441                                   b = TEV_MASK_CHECK( tmask, x );     /* Uninitialized Variable */
     Exit printtm / trc_print_tmask
Preconditions
tmask != 0
tmask != 1
&$unknown_12096146 != 0
&$unknown_12096147 >= 1
&$unknown_12096148 >= 1
&$unknown_12096149 >= 2
*pvmtevinfo[108].name <= 115
ntev = -1
pvmautoerr != 0
pvmautoerr != 2
pvmautoerr != 3
pvmmytid != -1
Postconditions
*stderr' is allocated by fopen
bytes_before(stderr)' = 0
c' = 0
flag' = &$unknown_12096146
strlen(&fmt[0])' = 20
fmt[20]' = 0
i' = 0
index' = 0
len' = strlen(pvmtevinfo[108])
maxlen' = strlen(pvmtevinfo[108]) + 4
ncols' = &$unknown_12096148
nrows' = &$unknown_12096147
ntev' = &$unknown_12096149
pvm_errno' = -2
tmask' = &tm[0]
x' = indices[0]




Change Warning 484.29258 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: