Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at tdpro.c:792

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2701.2754
Procedure: tm_conn2
Trace: View
Modified: Wed Sep 2 12:44: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
   /u1/paul/SATE/2010/c/pvm/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;
 760                         mp2 = mesg_new(0);
 761                         pkint(mp2, 1);
 762                         pkint(mp2, tid);
 763                         mp2->m_tag = SM_EXECACK;                /* XXX yecch, overload */   /* Null Pointer Dereference (ID: 2700.2753) */
 764                         mp2->m_dst = pvmschedtid;
 765                         sendmessage(mp2);
 766                 }
 767  
 768                 /* check for tracer */ 
 769                 if (pvmtracer.trctid && pvmtracer.trctag) {
 770                         tp2->t_trctid = pvmtracer.trctid;
 771                         tp2->t_trcctx = pvmtracer.trcctx;
 772                         tp2->t_trctag = pvmtracer.trctag;
 773                         /* Note:  can't get the trace mask or trace buffer size 
 774                                 to task here, but this will be handled using mailbox */ 
 775  
 776                         /* trace start message */ 
 777                         /* XXX Note:  we don't really know if we should send this 
 778                                 because this task could have prohibited tracing 
 779                                 by setting PvmSelfTraceTid to -1... */ 
 780                         tev_send_newtask( 
 781                                 pvmtracer.trctid, pvmtracer.trcctx, pvmtracer.trctag,
 782                                 tid, -1, -1, tp->t_a_out ? tp->t_a_out : "-" );
 783                 }
 784                 if (pvmtracer.outtid && pvmtracer.outtag) {
 785                         tp2->t_outtid = pvmtracer.outtid;
 786                         tp2->t_outctx = pvmtracer.outctx;
 787                         tp2->t_outtag = pvmtracer.outtag;
 788  
 789                         /* output start message */ 
 790                         /* Note:  same deal here as for TEV_NEWTASK above... */ 
true791                         mp2 = mesg_new(0);
mp2 <= 4095792                         mp2->m_dst = pvmtracer.outtid;     /* Null Pointer Dereference */
Preconditions
&$unknown_953547 != 0
&$unknown_953552 != 0
((char*)$param_1)[120] >= 0
numpmsgs = 0
pvmschedtid = 0
pvmtracer.trctid = 0
pvmtracer.outtag != 0
pvmtracer.outtid != 0
$input_12 = 1
$input_468 = 0
Postconditions
((char*)&$unknown_953550)[144]' = pvmtracer.outtid
((char*)&$unknown_953550)[148]' = pvmtracer.outctx
((char*)&$unknown_953550)[152]' = pvmtracer.outtag
c' = $input_484
strlen(&c)' = $input_468
cc' = 1
cookie' = &$unknown_953547
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
mp' = $param_2
mp2' = 0
taskname' = 0
tid' >= 0
tp' = $param_1
tp2' = &$unknown_953550




Change Warning 2701.2754 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: