Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Null Pointer Dereference  at tdpro.c:763

Categories: LANG.MEM.NPD CWE:476
Warning ID: 280.28951
Procedure: tm_conn2
Trace: view
Modified: Thu Nov 26 11:29:05 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/tdpro.c
   Enter tm_conn2
 670 tm_conn2(tp, mp) 
 671         struct task *tp;
 672         struct pmsg *mp;
 673 {
 674         int tid;
 675         int pid;                                                /* real pid of task */ 
 676         int cookie;                                             /* cookie to identify task or 0 */ 
 677         struct task *tp2;                               /* to search for existing context */ 
 678         struct pmsg *mp2;
 679         int cc;
 680         char c;
 681         char *taskname = (char *) NULL;
 682  
 683         if (upkint(mp, &pid) || upkint(mp, &cookie)) {
 684                 pvmlogerror("tm_conn2() bad msg format\n");
 685                 goto bail;
 686         }
 687         if (!cookie)
 688                 cookie = pid;
 689  
 690         if (!(tp->t_flag & TF_AUTH)) {
 691                 pvmlogprintf("tm_conn2() message from t%x, TF_AUTH not set\n",
 692                                 tp->t_tid);
 693                 return 0;
 694         }
 695  
 696         /*
 697         *       check that task could write d-auth file 
 698         */ 
 699  
 700 #ifndef NOPROT 
 701  
 702         if ((cc = read(tp->t_authfd, &c, 1)) == -1) {
 703                 pvmlogperror("tm_conn2() can't read d-auth file");
 704                 return 0;
 705         }
 706  
 707         if (cc != 1) {
 708                 pvmlogerror("tm_conn2() task didn't validate itself\n");
 709                 goto bail;
 710         }
 711  
 712         (void)close(tp->t_authfd);
 713         tp->t_authfd = -1;
 714         (void)unlink(tp->t_authnam);
 715  
 716 #endif 
 717  
 718         PVM_FREE(tp->t_authnam);
 719         tp->t_authnam = 0;
 720  
 721         /*
 722         *       if task spawned by us, already has a context,
 723         *       else make it one 
 724         */ 
 725  
 726         if ((tp2 = task_findpid(cookie)) && !(tp2->t_flag & (TF_AUTH|TF_CONN))) {
 727                 if (pvmdebmask & PDMTASK) {
 728                         pvmlogprintf("tm_conn2() reconnect task t%x\n", tp2->t_tid);
 729                 }
 730                 tp->t_sched = tp2->t_sched;
 731  
 732 #ifdef IMA_BEOLIN 
 733         } else if ( (tp2 = mpp_conn(tp))
 734                         && !(tp2->t_flag & (TF_AUTH|TF_CONN)) ) {
 735                 if (pvmdebmask & PDMTASK) {
 736                         pvmlogprintf(
 737                                         "tm_conn2() reconnect task t%x pid=%d name=%s\n",
 738                                         tp2->t_tid,tp2->t_pid, tp2->t_a_out );
 739                 } 
 740 #endif 
 741  
 742         } else {
 743                 if ((tid = tid_new()) < 0) {
 744                         pvmlogerror("tm_conn2() out of tids?\n");
 745                         goto bail;              /* XXX should disconnect nicely */ 
 746                 }
 747                 if ((tp2 = task_new(tid)) == NULL) {
 748                         pvmlogerror("tm_conn2() too many tasks?\n");
 749                         goto bail;              /* XXX should disconnect nicely */ 
 750                 }
 751  
 752                 if ( !upkstralloc(mp, &taskname) ) {
 753                         tp2->t_a_out = taskname;
 754                 }
 755  
 756                 if (pvmschedtid) {
 757                         /* inform the scheduler about the new task */ 
 758  
 759                         tp->t_sched = pvmschedtid;
true760                         mp2 = mesg_new(0);
 761                         pkint(mp2, 1);
 762                         pkint(mp2, tid);
mp2 <= 4095763                         mp2->m_tag = SM_EXECACK;                /* XXX yecch, overload */     /* Null Pointer Dereference */
Preconditions
&$unknown_840358 != 0
&$unknown_840358 >= locltasks->t_plink->t_pid + 1
&$unknown_840361 >= 1
tp->t_authfd >= 0
locltasks->t_plink != locltasks
numpmsgs = 0
pvmschedtid != 0
$input_12 = 1
$input_852 = 0
Postconditions
((char*)&$unknown_840360)[84]' = &$heap_310871
c' = $input_868
strlen(&c)' = $input_852
cc' = $input_12
cookie' = &$unknown_840358
errno' != 0
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
bytes_after(&$heap_310871)' = &$unknown_840361
$heap_310871' is allocated by malloc
bytes_before(&$heap_310871)' = 0
mp2' = 0
taskname' = &$heap_310871
tid' >= 0
tp2' = &$unknown_840360




Change Warning 280.28951 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: