Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Null Pointer Dereference  at tev.c:1296

Categories: LANG.MEM.NPD CWE:476
Warning ID: 2772.2827
Procedure: tev_flush
Trace: View
Modified: Wed Sep 2 12:45:56 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/tev.c
   Enter tev_flush
 1061 tev_flush( setflag ) 
 1062 int setflag;
 1063 {
 1064         char *event_names[ TEV_MAX - TEV_FIRST + 1 ];
 1065  
 1066         int timings_usec[ TEV_MAX - TEV_FIRST + 1 ];
 1067         int timings_sec[ TEV_MAX - TEV_FIRST + 1 ];
 1068         int counts[ TEV_MAX - TEV_FIRST + 1 ];
 1069  
 1070         struct timeval timestamp;
 1071  
 1072         int tsec, tusec;
 1073         int routetmp;
 1074         int savebuf;
 1075         int tmpbuf;
 1076         int num;
 1077         int tmp;
 1078         int i;
 1079  
 1080         if ( pvmtrc.trctid <= 0 || pvmmytid == pvmtrc.trctid )
 1081                 return;
 1082  
 1083         switch ( pvmtrc.trcopt ) 
 1084         {
 1085                 case PvmTraceFull
 1086                 {
 1087                         if ( setflag )
 1088                         {
 1089                                 /* Verify Trace Record Message Buffer */ 
 1090  
 1091                                 if ( !pvmtrcsbf )
 1092                                         return;
 1093  
   ...
 1101  
 1102                         if ( pvmtrc.trcbuf )
 1103                         {
 1104                                 tmp = TEV_MARK_EVENT_BUFFER_END;
 1105                                 pvm_pkint( &tmp, 1, 1 );
 1106                         }
 1107  
 1108                         break;
 1109                 }
 1110  
 1111                 case PvmTraceTime: 
 1112                 {
 1113                         /* Set Up Send Buffer */ 
 1114  
 1115                         pvmtrccodef = &pvmtrccodef_desc;
 1116  
 1117                         pvmtrcsbf = pvm_mkbuf( PvmDataDefault );
true1118                         pvmtrcmp = midtobuf( pvmtrcsbf );
 1119  
 1120                         savebuf = pvm_setsbuf( pvmtrcsbf );
 1121  
 1122                         /* Pack Event Marker */ 
 1123  
 1124                         tmp = TEV_MARK_EVENT_DESC;
 1125                         pvm_pkint( &tmp, 1, 1 );
 1126  
 1127                         /* Pack Descriptor Event ID & Event Name */ 
 1128  
 1129                         tmp = TEV_TIMING;
 1130                         pvm_pkint( &tmp, 1, 1 );
 1131  
 1132                         pvm_pkstr( pvmtevinfo[ TEV_TIMING - TEV_FIRST ].name );
 1133  
 1134                         /* Pack Event Header */ 
 1135  
 1136                         gettimeofday( &timestamp, (struct timezone *) 0 );
 1137  
 1138                         tsec = (int) timestamp.tv_sec;
 1139                         tusec = (int) timestamp.tv_usec;
 1140  
 1141                         TEV_PACK_INT( TEV_DID_TS, TEV_DATA_SCALAR, &tsec, 1, 1 );
 1142                         TEV_PACK_INT( TEV_DID_TU, TEV_DATA_SCALAR, &tusec, 1, 1 );
 1143                         TEV_PACK_INT( TEV_DID_TID, TEV_DATA_SCALAR,
 1144                                 &pvmmytid, 1, 1 );
 1145  
 1146                         /* Collect Timing Array */ 
 1147  
 1148                         num = 0;
 1149  
 1150                         for ( i=TEV_FIRST ; i <= TEV_MAX ; i++ )
 1151                         {
 1152                                 if ( pvmtevinfo[i].count > 0 )
 1153                                 {
 1154                                         event_names[num] = pvmtevinfo[i].name;
 1155  
 1156                                         timings_sec[num] = (int) pvmtevinfo[i].total.tv_sec;
 1157                                         timings_usec[num] = 
 1158                                                 (int) pvmtevinfo[i].total.tv_usec;
 1159  
 1160                                         counts[num] = pvmtevinfo[i].count;
 1161  
 1162                                         pvmtevinfo[i].total.tv_sec = 
 1163                                                 pvmtevinfo[i].total.tv_usec = 0;
 1164  
 1165                                         pvmtevinfo[i].count = 0;
 1166  
 1167                                         num++;
 1168                                 }
 1169                         }
 1170  
 1171                         /* Pack Number of Events & Arrays */ 
 1172  
 1173                         TEV_PACK_INT( TEV_DID_VCT, TEV_DATA_SCALAR,
 1174                                 &num, 1, 1 );
 1175  
 1176                         TEV_PACK_STRING( TEV_DID_VID, TEV_DATA_ARRAY,
 1177                                 event_names, num, 1 );
 1178  
 1179                         TEV_PACK_INT( TEV_DID_TGS, TEV_DATA_ARRAY,
 1180                                 timings_sec, num, 1 );
 1181  
 1182                         TEV_PACK_INT( TEV_DID_TGU, TEV_DATA_ARRAY,
 1183                                 timings_usec, num, 1 );
 1184  
 1185                         TEV_PACK_INT( TEV_DID_PRF, TEV_DATA_ARRAY,
 1186                                 counts, num, 1 );
 1187  
 1188                         /* Pack End of Descriptor Marker */ 
 1189  
 1190                         tmp = TEV_MARK_EVENT_DESC_END;
 1191                         pvm_pkint( &tmp, 1, 1 );
 1192  
 1193                         setflag = 1;
 1194  
 1195                         break;
 1196                 }
 1197  
 1198                 case PvmTraceCount
 1199                 {
 1200                         /* Set Up Send Buffer */ 
 1201  
 1202                         pvmtrccodef = &pvmtrccodef_desc;
 1203  
 1204                         pvmtrcsbf = pvm_mkbuf( PvmDataDefault );
 1205                         pvmtrcmp = midtobuf( pvmtrcsbf );
   ...
 1271  
 1272                 default
 1273                         pvmlogprintf( 
 1274                                 "Uh-Oh! Bogus Tracing Option (%d) in tev_flush()...\n",
 1275                                 pvmtrc.trcopt );
 1276                         return;
 1277         }
 1278  
 1279         /* Reset Send Buffer (Done Packing Stuff) */ 
 1280  
 1281         if ( setflag )
 1282                 pvm_setsbuf( savebuf );
 1283  
 1284         /* Clear Out Trace Buffer Global Before Entering mroute()... */ 
 1285         /* (save in tmpbuf for sending, needed for mhf_invoke event) */ 
 1286  
 1287         tmpbuf = pvmtrcsbf;
 1288  
 1289         pvmtrcsbf = 0;
 1290  
 1291         /* Send Message */ 
 1292  
 1293         if ( (routetmp = pvmrouteopt) == PvmRouteDirect )
 1294                 pvmrouteopt = PvmAllowDirect;
 1295  
pvmtrcmp <= 40951296         pvmtrcmp->m_ctx = pvmtrc.trcctx;     /* Null Pointer Dereference */
Preconditions
pvmsbuf->m_enc != 536870912
numpmsgs = 0
nxtmidhsiz <= pvmmidhsiz
pvmmidhfree = 0
pvmmidhsiz != 0
pvmrouteopt = 3
pvmtevinfo[108].count >= 1
pvmtrc.trctid != pvmmytid
pvmtrc.trctid >= 1
pvmtrc.trcopt = 2
Postconditions
i' = 109
num' = &$unknown_1477563
numpmsgs' = 49
pvmrouteopt' = 2
pvmtevinfo[108].total.tv_sec' = 0
pvmtevinfo[108].total.tv_usec' = 0
pvmtevinfo[108].count' = 0
pvmtrccodef' = &pvmtrccodef_desc.enc_byte
pvmtrcmp' = 0
pvmtrcsbf' = 0
routetmp' = pvmrouteopt
savebuf' = &$unknown_1477579
setflag' = 1
timestamp.tv_sec' = &$unknown_1477544
tmpbuf' = pvmmidhfree




Change Warning 2772.2827 : Null Pointer Dereference

Priority:
State:
Finding:
Owner:
Note: