Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at ddpro.c:612

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2448.2476
Procedure: hostfailentry
Trace: View
Modified: Wed Sep 2 12:39:35 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/ddpro.c
   Enter hostfailentry
 546 hostfailentry(hp) 
 547         struct hostd *hp;
 548 {
 549         int hpart = hp->hd_hostpart;
 550         struct waitc *wp, *wp2;
 551         struct pmsg *mp;
 552         struct pvmmentry *ep;
 553  
 554         if (pvmdebmask & PDMHOST) {
 555                 pvmlogprintf("hostfailentry() host %s\n", hp->hd_name);
 556                 hd_dump(hp);
 557         }
 558  
 559         if (hp == hosts->ht_hosts[hosts->ht_master]) {
 560                 pvmlogerror("hostfailentry() lost master host, we're screwwwed\n");
 561                 pvmbailout(0);
 562         }
 563  
 564         /*
 565         * if we're master pvmd, send HT_DEL message to all others 
 566         */ 
 567  
 568         if (hp->hd_hostpart && hosts->ht_master == hosts->ht_local) {
 569                 struct hostd *hp2;
 570                 int hh;
 571  
 572                 mp = mesg_new(0);
 573                 mp->m_tag = DM_HTDEL;   /* Null Pointer Dereference (ID: 2450.2478) */
 574                 pkint(mp, hosts->ht_serial);
 575                 pkint(mp, hp->hd_hostpart);
 576                 for (hh = hosts->ht_last; hh > 0; hh--)
 577                         if (hh != hosts->ht_local 
 578                         && (hp2 = hosts->ht_hosts[hh]) && hp2 != hp) {
 579                                 mp->m_ref++;
 580                                 mp->m_dst = hp2->hd_hostpart | TIDPVMD;
 581                                 sendmessage(mp);
 582                         }
 583                 pmsg_unref(mp);
 584  
 585                 /* inform the scheduler too */ 
 586  
 587                 if (pvmschedtid) {
 588                         mp = mesg_new(0);
 589                         mp->m_tag = SM_HOSTX;   /* Null Pointer Dereference (ID: 2449.2477) */
 590                         mp->m_dst = pvmschedtid;
 591                         pkint(mp, hp->hd_hostpart | TIDPVMD);
 592                         sendmessage(mp);
 593                 }
 594         }
 595  
 596         for (wp = waitlist->wa_link; wp != waitlist; wp = wp->wa_link) {
 597                 if (wp->wa_on && (wp->wa_on & TIDHOST) == hpart) {
 598                         switch (wp->wa_kind) {
 599  
 600                         case WT_ADDHOST:        /* the master must have died */ 
 601                         case WT_DELHOST:        /* the master must have died */ 
 602  
 603                                 pvmlogprintf("hostfailentry() can't deal with wait kind %d\n",
 604                                                 wp->wa_kind);
 605                                 break;
 606  
 607                         case WT_HTUPD: 
 608                                 if (wp->wa_peer == wp) {
 609                                         int hh;
 610  
true611                                         mp = mesg_new(0);
mp <= 4095612                                         mp->m_tag = DM_HTCOMMIT;     /* Null Pointer Dereference */
 613  
 614                                         for (hh = hosts->ht_last; hh > 0; hh--)
 615                                                 if (hh != hosts->ht_local && (hp = hosts->ht_hosts[hh])) {
 616                                                         mp->m_ref++;
 617                                                         mp->m_dst = hp->hd_hostpart | TIDPVMD;
 618                                                         sendmessage(mp);
 619                                                 }
 620                                         pmsg_unref(mp);
 621  
 622                                         busyadding = 0;
 623                                         sendmessage(wp->wa_mesg);
 624                                         wp->wa_mesg = 0;
 625                                 }
 626                                 break;
 627  
 628                         case WT_SPAWN: 
 629                                 {
 630                                         struct waitc_spawn *wxp;
 631                                         int retry = 0;
 632                                         int v;
 633  
 634                                         wxp = (struct waitc_spawn*)wp->wa_spec;
 635  
 636         /* mark tasks assigned to this host as failed */ 
 637         /* (or reset if PvmTaskDefault) */ 
 638  
 639                                         for (v = wxp->w_veclen; v-- > 0; )
 640                                                 if (wxp->w_vec[v] == hp->hd_hostpart)
 641                                                         if (!(wxp->w_flags 
 642                                                                         & (PvmTaskHost|PvmTaskArch)))
 643                                                         {
 644                                                                 wxp->w_vec[v] = 0;
 645                                                                 retry++;
 646                                                         }
 647                                                         else 
 648                                                                 wxp->w_vec[v] = PvmHostFail;
 649  
 650                                         ht_delete(wxp->w_ht, hp);
 651  
 652         /* try assigning task again without failed host */ 
 653  
 654                                         if ( retry )
 655                                                 assign_tasks(wp);
 656  
 657         /* is this was the last wait, reply to task */ 
 658  
 659                                         if (wp->wa_peer == wp)
 660                                                 assign_tasks(wp);
 661                                 }
 662                                 break;
 663  
 664                         case WT_TASK: 
 665  
 666         /* send message if we're the last waiter */ 
 667  
 668                                 if (wp->wa_peer == wp) {
 669                                         mp = wp->wa_mesg;
 670                                         mp->m_ref++;
 671                                         sendmessage(mp);
 672                                 }
 673                                 break;
 674  
 675                         case WT_HOSTSTART: 
 676  
 677         /* reply to waiter */ 
 678  
 679                                 busyadding = 0;
 680                                 if (wp->wa_spec) {
 681                                         free_waitc_add((struct waitc_add *)wp->wa_spec);
 682                                         wp->wa_spec = 0;
 683                                 }
 684                                 pkint(wp->wa_mesg, PvmDSysErr);
 685                                 sendmessage(wp->wa_mesg);
 686                                 wp->wa_mesg = 0;
 687                                 break;
 688  
 689                         case WT_TASKX: 
 690                                 if (wp->wa_tid && wp->wa_mesg) {
 691                                         sendmessage(wp->wa_mesg);
 692                                         wp->wa_mesg = 0;
 693                                 }
 694                                 mb_tidy(wp->wa_on);
 695                                 break;
 696  
 697                         case WT_RESET: 
 698                                 if (wp->wa_tid && wp->wa_mesg) {
 699                                         sendmessage(wp->wa_mesg);
 700                                         wp->wa_mesg = 0;
 701                                 }
 702                                 mb_tidy_reset(wp->wa_on);
 703                                 break;
 704  
 705                         case WT_RECVINFO: 
 706                                 /* clean up pending recvinfo */ 
 707                                 ep = (struct pvmmentry *) wp->wa_spec;
 708                                 if ( ep->me_msg )       /* class name (overload :-Q) */ 
 709                                         PVM_FREE( ep->me_msg );
 710                                 PVM_FREE( ep );
 711                                 break;
 712  
 713                         case WT_HOSTF: 
 714                                 sendmessage(wp->wa_mesg);
 715                                 wp->wa_mesg = 0;
 716                                 break;
 717  
 718                         case WT_PSTAT: 
 719                         case WT_MSTAT: 
 720                         case WT_HOSTSYNC: 
 721                                 pkint(wp->wa_mesg, PvmHostFail);
 722                                 sendmessage(wp->wa_mesg);
 723                                 wp->wa_mesg = 0;
 724                                 break;
 725  
 726                         default: 
 727                                 pvmlogprintf("hostfailentry() alien wait kind %d\n",
 728                                                 wp->wa_kind);
 729                                 break;
 730                         }
 731  
 732                         wp2 = wp->wa_rlink;
 733                         wait_delete(wp);
 734                         wp = wp2;
Preconditions
&$unknown_72264 != $param_1
&$unknown_72292 != waitlist
((char*)$param_1)[4] != 0
hosts->ht_local != 1
hosts->ht_last = 1
hosts->ht_master = hosts->ht_local
waitlist->wa_link != waitlist
((char*)&$unknown_72292)[20] = 6
((char*)&$unknown_72292)[24] != 0
((char*)&$unknown_72292)[40] = &$unknown_72292
numfrags != 0
numpmsgs != 0
pvmschedtid != 0
Postconditions
freefrags.fr_link->fr_link->fr_rlink' = freefrags.fr_link->fr_rlink
freepmsgs.m_link->m_link->m_rlink' = freepmsgs.m_link->m_rlink
((char*)$unknown_72278)[8]' = ((char*)&$unknown_72278)[8]
freepmsgs.m_link->m_frag' = &$unknown_72272
freefrags.fr_link->fr_rlink->fr_link' = freefrags.fr_link->fr_link
freepmsgs.m_link->m_rlink->m_link' = freepmsgs.m_link->m_link
((char*)$unknown_72278)[8]' = $unknown_72278
((char*)&$unknown_72272)[40]' = ((char*)&$unknown_72272)[40] - 1
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
hh' = hosts->ht_last - 1
hp2' = &$unknown_72264
hpart' = ((char*)$param_1)[4]
mp' = 0
numpmsgs' = 0
wp' = &$unknown_72292




Change Warning 2448.2476 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: