Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at lpvm.c:2722

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2805.2865
Procedure: pvmmcast
Trace: View
Modified: Wed Sep 2 12:47:37 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/lpvmgen.c
   Enter pvm_spawn
 3141 pvm_spawn(file, argv, flags, where, count, tids) 
 3142         char *file;
 3143         char **argv;
 3144         int flags;
 3145         char *where;
 3146         int count;
 3147         int *tids;
 3148 {
 3149         int sbf, rbf;   /* temp for current tx, rx msgs */ 
 3150         int ictx;
 3151         int cc;
 3152         int i, n;
 3153         char **ep;
true3154         int *tidlist = 0;
 3155         char *p;
 3156         char buf[TEV_MASK_LENGTH + 20];
 3157         TEV_DECLS 
 3158  
 3159         if (p = getenv("PVMTASK"))
 3160                 i = pvmstrtoi(p) | flags;
 3161         else 
 3162                 i = flags;
 3163  
 3164         if (TEV_EXCLUSIVE) {
 3165                 if (TEV_DO_TRACE(TEV_SPAWN,TEV_EVENT_ENTRY)) {
 3166                         TEV_PACK_STRING( TEV_DID_SE, TEV_DATA_SCALAR,
 3167                                 file ? file : "", 1, 1 );
 3168                         TEV_PACK_STRING( TEV_DID_SW, TEV_DATA_SCALAR,
 3169                                 where ? where : "", 1, 1 );
 3170                         TEV_PACK_INT( TEV_DID_SF, TEV_DATA_SCALAR, &i, 1, 1 );
 3171                         TEV_PACK_INT( TEV_DID_SC, TEV_DATA_SCALAR, &count, 1, 1 );
 3172                         TEV_FIN;
 3173                 }
 3174         }
 3175  
 3176         if (!(cc = BEATASK)) {
 3177                 if (count < 1)
 3178                         cc = PvmBadParam;
 3179  
 3180                 else {
 3181                         sbf = pvm_setsbuf(pvm_mkbuf(PvmDataFoo));
 3182                         rbf = pvm_setrbuf(0);
 3183  
 3184                         pvm_pkstr(file);
 3185                         pvm_pkint(&i, 1, 1);
 3186                         pvm_pkstr(where ? where : "");
 3187                         pvm_pkint(&count, 1, 1);
 3188                         if (argv)
 3189                                 for (n = 0; argv[n]; n++);
 3190                         else 
 3191                                 n = 0;
 3192                         pvm_pkint(&n, 1, 1);
 3193                         for (i = 0; i < n; i++)
 3194                                 pvm_pkstr(argv[i]);   /* Null Pointer Dereference (ID: 2809.2869) */
 3195  
 3196                         pvm_pkint( &(pvmctrc.outtid), 1, 1 );
 3197                         pvm_pkint( &(pvmctrc.outctx), 1, 1 );
 3198                         pvm_pkint( &(pvmctrc.outtag), 1, 1 );
 3199                         pvm_pkint( &(pvmctrc.trctid), 1, 1 );
 3200                         pvm_pkint( &(pvmctrc.trcctx), 1, 1 );
 3201                         pvm_pkint( &(pvmctrc.trctag), 1, 1 );
 3202  
 3203                         n = pvmgetenvars(&ep) + 4;   /* Leak (ID: 2804.2864) */
 3204                         pvm_pkint(&n, 1, 1);
 3205                         n -= 4;
 3206                         sprintf(buf, "PVMTMASK=%s", pvmctrc.tmask);
 3207                         pvm_pkstr(buf);
 3208                         sprintf(buf, "PVMTRCBUF=%d", pvmctrc.trcbuf);
 3209                         pvm_pkstr(buf);
 3210                         sprintf(buf, "PVMTRCOPT=%d", pvmctrc.trcopt);
 3211                         pvm_pkstr(buf);
 3212                         sprintf(buf, "PVMCTX=0x%x", pvmmyctx);
 3213                         pvm_pkstr(buf);
 3214                         if (n > 0) {
 3215                                 for (i = 0; i < n; i++)
 3216                                         pvm_pkstr(ep[i]);   /* Uninitialized Variable (ID: 2808.2868) */
 3217                                 PVM_FREE(ep);
 3218                         }
 3219  
 3220                         if (pvmschedtid)
 3221                                 cc = msendrecv(pvmschedtid, SM_SPAWN, PvmBaseContext);
 3222                         else 
 3223                                 cc = msendrecv(TIDPVMD, TM_SPAWN, SYSCTX_TM);
 3224                         if (cc > 0) {
 3225                                 pvm_upkint(&cc, 1, 1);
 3226                                 if (cc == count) {
 3227                                         tidlist = tids ? tids : TALLOC(count, int, "xxx");
 3228                                         pvm_upkint(tidlist, cc, 1);
 3229                                         cc = bubble(cc, tidlist);
 3230                                 }
 3231                                 pvm_freebuf(pvm_setrbuf(rbf));
 3232  
 3233                         } else 
 3234                                 pvm_setrbuf(rbf);
 3235                         pvm_freebuf(pvm_setsbuf(sbf));
 3236  
 3237                         if (cc > 0) {
 3238                                 sbf = pvm_setsbuf(pvm_mkbuf(PvmDataFoo));
 3239                                 pvm_pkint(&cc, 1, 1);
 3240                                 pvm_pkint(tidlist, cc, 1);
 3241                                 ictx = pvm_setcontext(SYSCTX_TC);
tidlist <= 40953242                                 pvmmcast(pvmsbuf->m_mid, tidlist, cc, TC_SIBLINGS);
     /u1/paul/SATE/2010/c/pvm/pvm3/src/lpvm.c
     Enter pvm_spawn / pvmmcast
$param_2 <= 40952704   pvmmcast(mid, tids, count, tag) 
 2705           int mid;        
 2706           int *tids;
 2707           int count;
 2708           int tag;
 2709   {
 2710           static struct timeval ztv = { 0, 0 };
 2711    
 2712           int *dst;
 2713           int i, j;
 2714           int cc = 0;
 2715           struct ttpcb *pcbp;
 2716           int sbf;
 2717    
 2718           /*
 2719           * make sorted list of destinations 
 2720           */ 
 2721           dst = TALLOC(count, int, "mcal");
tids <= 40952722           BCOPY(tids, dst, count * sizeof(int));     /* Null Pointer Dereference */  /* Null Pointer Dereference (ID: 2799.2859) */
     Exit pvm_spawn / pvmmcast
Preconditions
$param_1 != 0
$param_2 = 0
$param_4 = 0
&$unknown_1980150 != &$unknown_1980224 / 4
&$unknown_1980150 >= 1
&$unknown_1980194 >= 1
&$unknown_1980207 >= 1
&$unknown_1980224 = 4 * &$unknown_1980207
&$unknown_1980224 >= 4
pvmautoerr != 0
pvmautoerr != 2
pvmautoerr != 3
pvmmytid != -1
pvmtoplvl != 0
pvmtrc.trctid != pvmmytid
pvmtrc.trctid >= 1
pvmtrc.trcopt != 1
pvmtrc.trcopt != 2
pvmtrc.trcopt != 3
$input_12 >= 0
$input_60 != 48
Postconditions
*stderr' is allocated by fopen
bytes_before(stderr)' = 0
argv' = $param_2
cc' = 0
cc' = &$unknown_1980207
count' = &$unknown_1980150
count' = &$unknown_1980207
dst' = &$heap_187482
file' = $param_1
flags' = $param_3
$heap_187481' = $input_60
bytes_after(&$heap_187481)' = $input_12 + 1
$heap_187481' is allocated by malloc
$heap_187481' is a non-heap object
bytes_before(&$heap_187481)' = 0
strlen(&$heap_187481)' = $input_12
bytes_after(&$heap_187482)' = 4 * &$unknown_1980207
$heap_187482' is allocated by malloc
$heap_187482' is allocated
bytes_before(&$heap_187482)' = 0
i' = 0
n' = 0
p' = &$heap_187481
pvm_errno' = -2
pvmampushed' = 0
pvmamtraced' = pvmtoplvl
pvmmyctx' = 524287
pvmmytid' = -1
pvmtoplvl' = 0
sbf' = -2
tag' = -2147287028
tidlist' = 0
tids' = $param_6
tids' = 0
where' = $param_4




Change Warning 2805.2865 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: