Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Ignored Return Value  at pvmgsu_aux.c:1011

Categories: LANG.FUNCS.IRV CWE:252 CWE:253 POW10:7
Warning ID: 2973.3058
Procedure: pvm_scatter
Trace: View
Modified: Wed Sep 2 12:55:26 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     
LineSource
  /u1/paul/SATE/2010/c/pvm/pvm3/pvmgs/pvmgsu_aux.c
  Enter pvm_scatter
956 pvm_scatter(result, data, count, datatype, msgtag, gname, rootinst) 
957 void *result, *data;
958 int  count, datatype, msgtag, rootinst;
959 char *gname;
960 {
961     int roottid, myginst, datasize, gsize, *tids = 0, i, cc;
962     int sbuf, rbuf;
963  
964     int (*packfunc)(), (*unpackfunc)();  /* ptrs to pack and unpack functions */ 
965     int x;
966         int savectx;
967  
968         TEV_DECLS 
969  
970     BGN_TRACE( TEV_SCATTER, gname, TEV_DID_MC, &msgtag );
971  
972         /* set context for dynamic groups */ 
973         savectx = pvm_setcontext( SYSCTX_DG );
974  
975     if ( (result == NULL) || (count <= 0) ) /* check some parameters */ 
976     {
977         cc = PvmBadParam;
978         goto done;
979     }
980  
981     /* set up pointers to the appropriate pack and unpack routines */ 
982     if ( (cc = gs_pack_unpack(datatype, &packfunc, &unpackfunc)) < 0)
983         goto done;
984  
985     /* root must be member of the group */ 
986     if ( (roottid = pvm_gettid(gname,rootinst)) < 0 )
987     {
988         cc = roottid;
989         goto done;
990     }
991  
992     /* get instance number - caller must be in group */ 
993     if ( (cc = myginst = pvm_getinst(gname, pvmmytid)) < 0 ) goto done;
994  
995     /* I am the root node for the scatter operation */ 
996     if (myginst == rootinst)
997     {
998         if ( data == NULL) /* check data parameter */ 
999         {
1000             cc = PvmBadParam;
1001             goto done;
1002         }
1003  
1004         /* get the number of bytes per element of type datatype */ 
1005         if ( (cc = datasize = gs_get_datasize(datatype)) < 0  ) goto done;
1006    
1007         /* Get the list of tids.  These must be contiguous (no holes). */ 
1008         if ( (cc = gs_get_tidlist(gname, msgtag, &gsize, &tids, 1)) < 0)
1009             goto done;
1010    
1011         sbuf = pvm_mkbuf(PvmDataDefault);     /* Ignored Return Value */
1012    
1013         /* The root sends values to everyone, except itself, in the group.
1014            For itself, the root copies the data into its result array.
1015         */ 
1016         for (i=0; i<gsize; i++)
1017         {
1018             if (i == myginst)
1019               BCOPY((char *) data + i*datasize*count, (char *) result,
1020                     datasize*count);
1021             else 
1022             {
1023                 sbuf = pvm_initsend(PvmDataDefault);
1024                 if ((cc=(*packfunc)((char *)data+i*datasize*count,count,1))<0)
1025                 {
1026                 pvm_freebuf(pvm_setsbuf(sbuf));   /* restore user's sendbuf */ 
1027                 goto done;
1028                 }
1029                 if ( (cc = pvm_send( tids[i], msgtag)) < 0)
1030                 {
1031                     pvm_freebuf(pvm_setsbuf(sbuf)); /* restore user's sendbuf */ 
1032                     goto done;
1033                 }
1034             } /* end if-else */ 
1035         } /* end for-loop */ 
1036         pvm_freebuf(pvm_setsbuf(sbuf)); /* restore user's send buf */ 
1037     }
1038     else 
1039     {
1040         /* everyone receives a result from the root, except the root */ 
1041         rbuf = pvm_setrbuf(0);
1042         if ( (cc = pvm_recv( roottid, msgtag )) < 0)
1043         {
1044             pvm_freebuf(pvm_setrbuf(rbuf)); /* restore user's receive buf */ 
1045             goto done;
1046         }
1047         if ( (cc = (*unpackfunc)( result, count, 1)) < 0)
1048         {
1049             pvm_freebuf(pvm_setrbuf(rbuf)); /* restore user's receive buf */ 
1050             goto done;
1051         }
1052         pvm_freebuf(pvm_setrbuf(rbuf)); /* restore user's receive buf */ 
1053      
1054     }  /* end if-else */ 
1055          
1056     cc = PvmOk;
1057  
1058 done: 
1059  
1060         /* restore user context */ 
1061         pvm_setcontext( savectx );
1062  
1063     if (tids) free(tids);
1064    
1065     if (cc < 0) lpvmerr("pvm_scatter",cc);
1066  
1067     END_TRACE( TEV_SCATTER, TEV_DID_CC, &cc);
1068  
1069     return(cc);
1070  
1071 }  /* end pvm_scatter() */ 




Change Warning 2973.3058 : Ignored Return Value

Priority:
State:
Finding:
Owner:
Note: