Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2726.2779
Procedure: tm_notify
Trace: View
Modified: Wed Sep 2 12:44:27 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_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");
 1979                                 return 0;
 1980                         }
 1981  
 1982                         if (flags & PvmNotifyCancel) {
 1983                                 FORLIST (wp, waitlist, wa_link) 
 1984                                         if (wp->wa_kind == WT_TASKX 
 1985                                         && wp->wa_on == tid 
 1986                                         && wp->wa_tid == tp->t_tid 
 1987                                         && wp->wa_mesg->m_ctx == ctx 
 1988                                         && wp->wa_mesg->m_tag == tag)
 1989                                                 break;
 1990                                 if (wp != waitlist) {
 1991                                         sendmessage(wp->wa_mesg);
 1992                                         wp->wa_mesg = 0;
 1993                                         if ((hp = tidtohost(hosts, tid)) 
 1994                                         && hp->hd_hostpart != myhostpart)
 1995                                                 wp->wa_tid = 0;
 1996                                         else 
 1997                                                 wait_delete(wp);
 1998                                 }
 1999  
 2000                         } else {
 2001                                 /* make reply message */ 
 2002  
true2003                                 mp2 = mesg_new(0);
mp2 <= 40952004                                 mp2->m_dst = tp->t_tid;     /* Null Pointer Dereference */
 2005                                 mp2->m_ctx = ctx;
 2006                                 mp2->m_tag = tag;
 2007                                 mp2->m_wid = mp->m_wid;
 2008                                 pkint(mp2, tid);
 2009  
 2010                                 /* if task doesn't exist, reply immediately */ 
 2011  
 2012                                 if (!(hp = tidtohost(hosts, tid)) 
 2013                                 || (hp->hd_hostpart == myhostpart && !task_find(tid)))
 2014                                         sendmessage(mp2);
 2015  
 2016                                 else {
 2017  
 2018                                         /* otherwise make a wc for it */ 
 2019  
 2020                                         wp = wait_new(WT_TASKX);
 2021                                         wp->wa_on = tid;
 2022                                         wp->wa_tid = tp->t_tid;
 2023                                         wp->wa_dep = mp->m_wid;
 2024                                         wp->wa_mesg = mp2;
 2025  
 2026                                         /* and if not on this host, pass on the request */ 
 2027  
 2028                                         if (hp->hd_hostpart != myhostpart) {
 2029                                                 mp2 = mesg_new(0);
 2030                                                 pkint(mp2, what);
 2031                                                 pkint(mp2, tid);
 2032                                                 mp2->m_dst = hp->hd_hostpart | TIDPVMD;
 2033                                                 mp2->m_tag = DM_NOTIFY;
 2034                                                 mp2->m_wid = wp->wa_wid;
 2035                                                 sendmessage(mp2);
Postconditions
count' >= 3
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
mp' = $param_2
mp2' = 0
numpmsgs' = 0
tp' = $param_1
what' = 1




Change Warning 2726.2779 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: