Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at hoster.c:577

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2483.2512
Similar Warnings: 2483.2511
Procedure: pl_startup
Trace: View
Modified: Wed Sep 2 12:39:48 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/src/hoster.c
   Enter pl_startup
 480 pl_startup(num, hostlist) 
 481         int num;
 482         struct hst **hostlist;
 483 {
 484         int nxth = 0;                                           /* next host in list to start */ 
 485         struct slot *slact = 0;                         /* active list of slots */ 
 486         struct hst *hp;
 487         struct slot *sp, *sp2;
 488         struct timeval tnow;
 489         struct timeval tout;
 490 #ifdef FDSETNOTSTRUCT 
 491         fd_set rfds;                                            /* emx headers */ 
 492 #else 
 493         struct fd_set rfds; 
 494 #endif 
 495         int nfds;
 496         int i;
 497         int n;
 498         char *p;
 499  
 500         /* init slot free list */ 
 501  
 502         slfree = &slots[RSHNPLL+1];
 503         slfree->s_link = slfree->s_rlink = slfree;
 504         slact = &slots[RSHNPLL];
 505         slact->s_link = slact->s_rlink = slact;
 506         for (i = RSHNPLL; i-- > 0; ) {
 507                 LISTPUTAFTER(slfree, &slots[i], s_link, s_rlink);
 508         }
 509  
 510         /*
 511         * keep at this until all hosts in table are completed 
 512         */ 
 513  
 514         for (; ; ) {
 515  
 516                 /*
 517                 * if empty slots, start on new hosts 
 518                 */ 
 519  
 520                 for (; ; ) {
 521  
 522                         /* find a host for slot */ 
 523  
 524                         if (slfree->s_link != slfree && nxth < num)
 525                                 hp = hostlist[nxth++];
 526                         else 
 527                                 break;
 528  
 529                         sp = slfree->s_link;
 530                         LISTDELETE(sp, s_link, s_rlink);
 531                         sp->s_hst = hp;
 532                         sp->s_len = 0;
 533                         sp->s_elen = 0;
 534                         if (pvmdebmask & PDMSTARTUP) {
 535                                 pvmlogprintf("pl_startup() trying %s\n", hp->h_name);
 536                         }
 537                         phase1(sp);
 538                         if (hp->h_result) {
 539                                 /* error or fully started (manual startup) */ 
 540  
 541                                 if (pvmdebmask & PDMSTARTUP) {
 542                                         pvmlogprintf( 
 543                                         "pl_startup() got result \"%s\" for %s phase1()\n",
 544                                                 hp->h_result, hp->h_name);
 545                                 }
 546  
 547                                 LISTPUTBEFORE(slfree, sp, s_link, s_rlink);
 548  
 549                         } else {
 550                                 /* partially started */ 
 551  
 552                                 LISTPUTBEFORE(slact, sp, s_link, s_rlink);
 553                                 pvmgetclock(&sp->s_bail);
 554                                 tout.tv_sec = RSHTIMEOUT;
 555                                 tout.tv_usec = 0;
 556                                 TVXADDY(&sp->s_bail, &sp->s_bail, &tout);
 557                         }
 558                 }
 559  
 560                 /* if no hosts in progress, we are finished */ 
 561  
 562                 if (slact->s_link == slact)
 563                         break;
 564  
 565                 /*
 566                 * until next timeout, get output from any slot 
 567                 */ 
 568  
 569                 FD_ZERO(&rfds);
 570                 nfds = 0;
 571                 TVCLEAR(&tout);
 572                 pvmgetclock(&tnow);
 573                 for (sp = slact->s_link; sp != slact; sp = sp->s_link) {
 574                         if (TVXLTY(&sp->s_bail, &tnow)) {
 575                                 pvmlogprintf("pl_startup() giving up on host %s after %d secs\n",
 576                                                 sp->s_hst->h_name, RSHTIMEOUT);
true577                                 sp->s_hst->h_result = STRALLOC("PvmCantStart");     /* Null Pointer Dereference */
Preconditions
$param_1 >= 1
&slots[0].s_link != &$unknown_105943 - 3456
&slots[0].s_link != &$unknown_105947 - 2880
((char*)&$unknown_105947)[24] <= &$unknown_105946 - 1
Postconditions
__arr' = &rfds.__fds_bits[0]
__i' = 16
((char*)&$unknown_105943)[564]' = 0
((char*)&$unknown_105943)[568]' = 0
hostlist' = $param_2
i' = -1
nfds' = 0
num' = $param_1
nxth' = $param_1
rfds.__fds_bits[15]' = 0
slact' = &slots[0].s_link + 2880
slfree' = &slots[0].s_link + 3456
slots[5].s_link' = &$unknown_105947
slots[6].s_link' = &$unknown_105943
sp' = &$unknown_105947
tnow.tv_sec' = &$unknown_105946
tout.tv_sec' = 0
tout.tv_usec' = 0




Change Warning 2483.2512 : Null Pointer Dereference

Because they are very similar, this warning shares annotations with warning 2483.2511.
CodeSonar has selected warning 2483.2511 to represent this group of similar warnings. In order to edit this group, you must edit warning 2483.2511.