Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 308.28984
Procedure: tm_notify
Trace: view
Modified: Thu Nov 26 11:29:22 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_notify
 1948 tm_notify(tp, mp) 
 1949         struct task *tp;
 1950         struct pmsg *mp;
 1951 {
 1952         int what, flags, ctx, tag, count, tid;
 1953         struct hostd *hp;
 1954         struct pmsg *mp2;
 1955         struct waitc *wp;
 1956         int i;
 1957  
 1958         if (upkint(mp, &what) 
 1959         || upkint(mp, &ctx) 
 1960         || upkint(mp, &tag) 
 1961         || upkint(mp, &count)) {
 1962                 pvmlogerror("tm_notify() bad msg format\n");
 1963                 return 0;
 1964         }
 1965  
 1966         flags = what;
 1967         what &= 0xff;
 1968         switch (what) {
 1969  
 1970         /*
 1971         * TaskExit: make a wait context that hangs out until the task is 
 1972         * cleaned up.
 1973         */ 
 1974  
 1975         case PvmTaskExit: 
 1976                 for (i = 0; i < count; i++) {
 1977                         if (upkuint(mp, &tid)) {
 1978                                 pvmlogerror("tm_notify() bad msg format\n");
   ...
 2032                                                 mp2->m_dst = hp->hd_hostpart | TIDPVMD;
 2033                                                 mp2->m_tag = DM_NOTIFY;
 2034                                                 mp2->m_wid = wp->wa_wid;
 2035                                                 sendmessage(mp2);
 2036                                         }
 2037                                 }
 2038                         }
 2039                 }
 2040                 break;
 2041  
 2042         case PvmHostDelete: 
 2043                 for (i = 0; i < count; i++) {
 2044                         if (upkuint(mp, &tid)) {
 2045                                 pvmlogerror("tm_notify() bad msg format\n");
 2046                                 return 0;
 2047                         }
 2048                         if (flags & PvmNotifyCancel) {
 2049                                 if (hp = tidtohost(hosts, tid)) {
 2050                                         FORLIST (wp, waitlist, wa_link) 
 2051                                                 if (wp->wa_kind == WT_HOSTF 
 2052                                                 && wp->wa_on == hp->hd_hostpart 
 2053                                                 && wp->wa_tid == tp->t_tid 
 2054                                                 && wp->wa_mesg->m_ctx == ctx 
 2055                                                 && wp->wa_mesg->m_tag == tag)
 2056                                                         break;
 2057                                         if (wp != waitlist) {
 2058                                                 sendmessage(wp->wa_mesg);
 2059                                                 wp->wa_mesg = 0;
 2060                                                 wait_delete(wp);
 2061                                         }
 2062                                 }
 2063  
 2064                         } else {
true2065                                 mp2 = mesg_new(0);
mp2 <= 40952066                                 mp2->m_dst = mp->m_src;     /* Null Pointer Dereference */
 2067                                 mp2->m_ctx = ctx;
 2068                                 mp2->m_tag = tag;
 2069                                 pkint(mp2, tid);
 2070                                 if (hp = tidtohost(hosts, tid)) {
 2071                                         wp = wait_new(WT_HOSTF);
 2072                                         wp->wa_tid = tp->t_tid;
 2073                                         wp->wa_on = hp->hd_hostpart;
 2074                                         wp->wa_mesg = mp2;
 2075  
 2076                                 } else {
 2077                                         sendmessage(mp2);
Postconditions
count' >= 2
errno' != 0
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
mp2' = 0
numpmsgs' = 0
what' = 2




Change Warning 308.28984 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: