Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Uninitialized Variable  at lpvmgen.c:4435

Categories: LANG.MEM.UVAR CWE:457
Warning ID: 355.29041
Procedure: pvm_delmhf
Trace: view
Modified: Thu Nov 26 11:30:01 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/src/lpvmgen.c
   Enter pvm_delmhf
true4333 pvm_delmhf(mhid) 
 4334         int mhid;                       /* message handler index */ 
 4335 {
 4336         char *errstr;
 4337         int htoid;                      /* handle - moved to   - id location */ 
 4338         int hfrid;                      /* handle - moved from - id location */ 
 4339         int rc = 0;
 4340         TEV_DECLS 
 4341  
 4342         if (TEV_EXCLUSIVE) {
 4343                 if (TEV_DO_TRACE(TEV_DELMHF,TEV_EVENT_ENTRY)) {
 4344                         TEV_PACK_INT( TEV_DID_MHI, TEV_DATA_SCALAR, &mhid, 1, 1 );
 4345                         TEV_FIN;
 4346                 }
 4347         }
 4348  
 4349         /*
 4350         *  check incomming parameter at lower and upper boundary 
 4351         *       - can't have negative mhid values 
 4352         *       - too high an index - mhid entry does not exist 
 4353         */ 
 4354         if (mhid < 0) { /* too low */ 
 4355                 errstr = "pvm_delmhf";
 4356                 rc = PvmBadParam;
 4357         }
 4358         else if (mhid >= ndhandles) { /* too high */ 
 4359                 errstr = "(mhid >= ndhandles) pvm_delmhf";
 4360                 rc = PvmNotFound;
 4361         }
 4362  
 4363         /*
 4364         *  make sure is not already on free list - can only delete active 
 4365         *  mhid entries 
 4366         *
 4367         *  confirm active by:
 4368         *    since handles is contiguous at low order indices, thus any 
 4369         *    entry in dhandles[x].handle less-than nhandles is an active 
 4370         *    entry and may be deleted 
 4371         */ 
 4372         if ( rc >= 0 ) {
 4373                 if ( dhandles[mhid].handle < nhandles ) {
 4374                         /*
 4375                         *  this one's active - delete it 
 4376                         */ 
 4377  
 4378                         nhandles--;             /* reduce # of active handles[] entries */ 
 4379                         htoid = dhandles[mhid].handle;  /* handle - moved to */ 
 4380                                                                                         /* -id location */ 
 4381                         hfrid = nhandles;               /* handle - moved from - id loc */ 
 4382  
 4383                         /* Don't Spank List if Last Entry...  D-Oh! */ 
 4384                         if ( htoid != hfrid )
 4385                         {
 4386                                 /*
 4387                                 *  move the last "active" handle[] entry up to "deleted"
 4388                                 *  location 
 4389                                 */ 
 4390  
 4391                                 handles[htoid] = handles[hfrid];        /* the move */ 
 4392  
 4393                                 /* unnecessary?! handles[hfrid].mhid = htoid; */ 
 4394                                 /* ("back-link" ptr adjust?) */ 
 4395  
 4396                                 /*
 4397                                 *  adjust dhandles[] to point to 
 4398                                 *    1. the moved "up" entry 
 4399                                 *    2. the "deleted" entry 
 4400                                 */ 
 4401  
 4402                                 /* 1. the moved "up" entry */ 
 4403                                 dhandles[handles[htoid].mhid].handle = htoid;
 4404  
 4405                                 /* 2. the "deleted" entry */ 
 4406                                 dhandles[mhid].handle = hfrid;
 4407                         }
 4408  
 4409                         /*
 4410                         *  put the "freed" dhandle entry (mhid value) on head of 
 4411                         *  the free list 
 4412                         */ 
 4413  
 4414                         /* link this to previous free list */ 
 4415                         dhandles[mhid].mhid = fl_dhandles;
 4416  
 4417                         fl_dhandles = mhid;             /* put this one on head of list */ 
 4418                 }
 4419                 else {
 4420                         /* this one is already on free list - not active entry */ 
 4421                         errstr = "pvm_delmhf";
 4422                         rc = PvmNotFound;
 4423                 }
 4424         }
 4425  
 4426         if (TEV_AMEXCL) {
 4427                 if (TEV_DO_TRACE(TEV_DELMHF,TEV_EVENT_EXIT)) {
 4428                         TEV_PACK_INT( TEV_DID_CC, TEV_DATA_SCALAR, &rc, 1, 1 );
 4429                         TEV_FIN;
 4430                 }
 4431                 TEV_ENDEXCL;
 4432         }
 4433  
 4434         if (rc < 0)
errstr is uninitialized4435                 lpvmerr(errstr, rc);     /* Uninitialized Variable */
Preconditions
&$unknown_1377151 != 0
&$unknown_1377152 != nhandles - 1
&$unknown_1377153 >= 1
&$unknown_1377155 != 0
ndhandles >= 1
pvmmytid = -1
pvmtoplvl != 0
pvmtrc.trctid >= 1
Postconditions
hfrid' = nhandles - 1
htoid' = &$unknown_1377152
mhid' >= 0
mhid' <= ndhandles - 1
pvmampushed' = 0
pvmamtraced' = pvmtoplvl
pvmmytid' != &$unknown_1377153
pvmtrc.trctid' = &$unknown_1377153
rc' <= -1




Change Warning 355.29041 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: