Text  |   XML   |   Visible Warnings:

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

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2589.2621
Similar Warnings: 2589.2623
Procedure: dm_db
Trace: View
Modified: Wed Sep 2 12:41:54 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 dm_db
 2943 dm_db(hp, mp) 
 2944         struct hostd *hp;
 2945         struct pmsg *mp;
 2946 {
 2947         int opcode;                                     /* op requested */ 
 2948         int tid;
 2949         int req;                                        /* index requested */ 
 2950         int flags;
 2951         char *name = 0;                         /* class name */ 
 2952         struct pmsg *mp2 = 0;           /* reply */ 
 2953         struct pmsg *mp3 = 0;           /* data message */ 
 2954  
 2955         struct waitc *wp, *wp2;         /* wait ctx ptrs (notify, recvinfo */ 
 2956         struct pmsg *mp4 = 0;           /* notify forward message */ 
 2957         struct hostd *hp2;                      /* remote notify host */ 
 2958  
 2959         struct pvmmclass *np, *np2;     /* reset pointers */ 
 2960         struct pvmmentry *ep, *ep2;     /* reset pointers */ 
 2961         int *noresets;                          /* noreset tids */ 
 2962         int nnr;                                        /* # of noreset tasks */ 
 2963         int found;
 2964         int cc;
 2965         int i;
 2966         int notified;
 2967  
 2968         hp = hp;
 2969  
 2970         if (upkint(mp, &opcode) || upkint(mp, &tid) 
 2971         || upkstralloc(mp, &name) || upkint(mp, &req) || upkint(mp, &flags))
 2972                 goto badformat;
 2973  
 2974         mp2 = mesg_new(0);
 2975         mp2->m_dst = mp->m_src;   /* Null Pointer Dereference (ID: 2599.2633) */
 2976         mp2->m_tag = DM_DBACK;
 2977         mp2->m_wid = mp->m_wid;
 2978  
 2979         switch (opcode) {
 2980  
 2981         case TMDB_PUT: 
 2982                 mp3 = mesg_new(0);
 2983                 if (pmsg_unpack(mp, mp3))
 2984                         goto badformat;
 2985                 if ((req = mb_insert(tid, name, req, flags, mp3)) < 0)
 2986                         pmsg_unref(mp3);
 2987                 else {
 2988  
 2989                         /* check for any pending requests for this mbox entry */ 
 2990                         notified = 0;
 2991                         for (wp = waitlist->wa_link; wp != waitlist; wp = wp2) {
 2992                                 wp2 = wp->wa_link;
 2993                                 if (wp->wa_kind == WT_RECVINFO) {
 2994                                         ep = (struct pvmmentry *) wp->wa_spec;
 2995                                         if ( !strcmp( (char *) ep->me_msg, name ) ) {
 2996                                                 cc = mb_lookup(ep->me_tid, (char *) ep->me_msg,
 2997                                                         ep->me_ind, ep->me_flags, &mp3);
 2998                                                 if ( cc != PvmNotFound ) {
 2999                                                         pkint(wp->wa_mesg, cc);
 3000                                                         if (mp3) {
 3001                                                                 pmsg_pack(wp->wa_mesg, mp3);
 3002                                                                 pmsg_unref(mp3);
 3003                                                         }
 3004                                                         sendmessage(wp->wa_mesg);
 3005                                                         wp->wa_mesg = 0;
 3006                                                         PVM_FREE(ep->me_msg);
 3007                                                         PVM_FREE(ep);
 3008                                                         wait_delete(wp);
 3009                                                 }
 3010                                         }
 3011                                 }
 3012                                 /* check if task needs mbox notify for mb_tidy()... */ 
 3013                                 else if (wp->wa_kind == WT_TASKX) {
 3014                                         if ( wp->wa_on == tid && wp->wa_tid == pvmmytid )
 3015                                                 notified++;
 3016                                 }
 3017                         }
 3018  
 3019                         /* create mbox notify for mb_tidy() cleanup... */ 
 3020                         if ( !notified ) {
 3021                                 /* dummy notify for clean up */ 
 3022                                 wp = wait_new(WT_TASKX);
 3023                                 wp->wa_on = tid;
 3024                                 wp->wa_tid = pvmmytid;
 3025                                 wp->wa_dep = 0;
 3026                                 wp->wa_mesg = (struct pmsg *) NULL;
 3027  
 3028                                 /* pass on to non-master host */ 
 3029                                 hp2 = tidtohost(hosts, tid);
 3030                                 if ( hp2 && hp2->hd_hostpart != myhostpart ) {
true3031                                         mp4 = mesg_new(0);
 3032                                         pkint(mp4, PvmTaskExit);
 3033                                         pkint(mp4, tid);
mp4 <= 40953034                                         mp4->m_dst = hp2->hd_hostpart | TIDPVMD;     /* Null Pointer Dereference */
Preconditions
&$unknown_721643 >= 1
&$unknown_721650 = &$unknown_721651 + 136
&$unknown_721650 >= 4232
&$unknown_721668 = 0
&$unknown_721669 = 0
pvmmboxclasses->mc_link->mc_ent->me_link->me_ind != -32
pvmmboxclasses->mc_link->mc_ent->me_link->me_ind >= ((char*)waitlist->wa_link->wa_spec)[16]
waitlist->wa_link->wa_kind = 18
waitlist->wa_link->wa_peer >= 0
waitlist->wa_link->wa_mesg = &freepmsgs.m_link
hosts->ht_last >= 1
strlen(((char*)waitlist->wa_link->wa_spec)[32]) = strlen(pvmmboxclasses->mc_link->mc_name)
pvmmboxclasses->mc_link->mc_ent->me_link != pvmmboxclasses->mc_link->mc_ent
waitlist->wa_link->wa_link = waitlist
pvmmboxclasses->mc_link != pvmmboxclasses
waitlist->wa_link != waitlist
((char*)&$unknown_721667)[4] != myhostpart
numfrags = 0
numpmsgs = 1
widrange >= lastwid + 1
Postconditions
waitlist->wa_link->wa_mesg->m_frag' = 0
waitlist->wa_link->wa_mesg->m_rlink' = waitlist->wa_link->wa_mesg
freepmsgs.m_link->m_link->m_rlink' = freepmsgs.m_link->m_rlink
waitlist->wa_link->wa_mesg' = 0
freepmsgs.m_link->m_tag' = -2147352552
waitlist->wa_rlink' = &$heap_39140
((char*)*waitlist->wa_link->wa_spec)[32]' is freed
waitlist->wa_link->wa_mesg->m_link' = &freepmsgs.m_link
*waitlist->wa_link->wa_spec' is freed
freepmsgs.m_link->m_rlink->m_link' = freepmsgs.m_link->m_link
waitlist->wa_rlink->wa_link' = &$heap_39140
*waitlist->wa_link' is freed
((char*)$unknown_721651)[8]' = &$unknown_721650
$unknown_721650' = &freepmsgs.m_link
((char*)&$unknown_721650)[8]' = ((char*)&$unknown_721651)[8]
cc' = pvmmboxclasses->mc_link->mc_ent->me_link->me_ind
ep' = waitlist->wa_link->wa_spec
freepmsgs.m_link' = &freepmsgs.m_link
freepmsgs.m_rlink' = &freepmsgs.m_link
bytes_after(&$heap_39139)' = &$unknown_721643
$heap_39139' is allocated by malloc
bytes_before(&$heap_39139)' = 0
$heap_39140' = waitlist
bytes_after(&$heap_39140)' = 80
$heap_39140' is allocated by malloc
$heap_39140' is allocated
bytes_before(&$heap_39140)' = 0
((char*)&$heap_39140)[16]' <= waitlist->wa_wid - 1
((char*)&$heap_39140)[20]' = 8
((char*)&$heap_39140)[28]' = pvmmytid
((char*)&$heap_39140)[32]' = 0
((char*)&$heap_39140)[56]' = 0
((char*)&$heap_39140)[64]' = 0
((char*)&$heap_39140)[72]' = 0
((char*)&$heap_39140)[8]' = waitlist->wa_rlink
hp' = $param_1
hp2' = &$unknown_721667
lastwid' = lastwid + 1
mp' = $param_2
mp2' = freepmsgs.m_link
mp3' = pvmmboxclasses->mc_link->mc_ent->me_link->me_msg
mp4' = 0
name' = &$heap_39139
notified' = 0
numpmsgs' = 0
opcode' = 1
req' >= 0
wp' = &$heap_39140
wp2' = waitlist->wa_link->wa_link




Change Warning 2589.2621 : Null Pointer Dereference

Because they are very similar, this warning shares annotations with warning 2589.2623.

Priority:
State:
Finding:
Owner:
Note: