Text  |   XML   |   Visible Warnings:

pvm3.4.6 : pvm3.4.6 analysis 2 : Uninitialized Variable  at pvmcruft.c:1316

Categories: LANG.MEM.UVAR CWE:457
Warning ID: 344.29022
Procedure: print_fdset
Trace: view
Modified: Thu Nov 26 11:29:39 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
   /kat0/fletcher/SATE/2010/pvm3/src/lpvm.c
   Enter mxfer
true1789 mxfer(txup, tmout) 
 1790         struct pmsg *txup;                      /* outgoing message or null */ 
 1791         struct timeval *tmout;          /* time limit to get at least one message */ 
 1792 {
 1793         struct ttpcb *txpcbp = 0;       /* route for ogm */ 
 1794         struct frag *txfp = 0;          /* cur ogm frag or null */ 
 1795         struct timeval tin;
 1796         struct timeval tnow;
 1797         struct timeval *tvp;
 1798 #ifdef FDSETNOTSTRUCT 
 1799         fd_set rfds, wfds;
 1800 #else 
 1801         struct fd_set rfds, wfds; 
 1802 #endif 
 1803         int wantmore = 1;                       /* nothing rxd yet and not timed out */ 
 1804         int gotem = 0;                          /* count of received msgs downloaded */ 
 1805         int ff;
 1806         int n;
 1807 #ifdef SOCKLENISUINT 
 1808 #if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2)
 1809         unsigned int oslen;
 1810 #else 
 1811         size_t oslen;
 1812 #endif 
 1813 #else 
 1814         int oslen;
 1815 #endif 
 1816         char *txcp = 0;                         /* point to remainder of txfp */ 
 1817         int txtogo = 0;                         /* len of remainder of txfp */ 
 1818         struct sockaddr_in sad;
 1819         int s;
 1820         struct ttpcb *pcbp;
 1821         char *inPlaceHeader = (char  *) NULL;   /* for inplace data */ 
 1822         int inPlaceBodyLen = 0;                                 /* len of inplace body */       
 1823         int bypassRead = FALSE;                         /* bypass reading packets before send?*/ 
 1824         int waitForOgmToComplete = FALSE;
 1825         int probedForIncomingPkts = FALSE;      /* need to probe for incoming pkts */ 
 1826         struct msgid *sendmsg = (struct msgid *) NULL;
 1827         char errtxt[64];
 1828  
 1829         int nfr = 0, totfr = 0;                         /* number frags read my mxinput */ 
 1830         int probe = 0;                                          /* called at a probe (nrecv) */ 
 1831  
 1832         if (tmout)
 1833         {
 1834                 pvmgetclock(&tin);
 1835                 probe = ( tmout -> tv_sec == 0 && tmout -> tv_usec == 0);
 1836         }
 1837  
 1838         if (txup) {     /* transmitting a umsg */ 
 1839                 txfp = txup->m_frag->fr_link;
 1840                 if (!txfp->fr_buf) {
 1841                         if (!(txfp = fr_new(MAXHDR)))   /* Leak (ID: 22100.29019) */
 1842                                 return PvmNoMem;
 1843                         txfp->fr_dat += MAXHDR;
 1844                         LISTPUTBEFORE(txup->m_frag, txfp, fr_link, fr_rlink);
 1845                 }
 1846                 /* Get connection info for this dest. If none, go to pvmd */ 
 1847                 if (!(txpcbp = ttpcb_find(txup->m_dst)) || txpcbp->tt_state != TTOPEN)
 1848                         txpcbp = topvmd;
 1849                 txup->m_ref++;
 1850                 bypassRead = TRUE;              /* bypass reading the first time through */ 
 1851         }
 1852  
 1853         if (pvmdebmask & PDMMESSAGE) {
 1854                 pvmlogprintf("mxfer() mid %d", (txup ? txup->m_mid : 0));
 1855                 if (txup)
 1856                         pvmlogprintf(" ctx %d tag %s dst t%x route t%x",
 1857                                         txup->m_ctx,
 1858                                         pvmnametag(txup->m_tag, (int *)0),
 1859                                         txup->m_dst, txpcbp->tt_tid);
 1860                 if (tmout)
 1861                         pvmlogprintf(" tmout %d.%06d\n",
 1862                                         tmout->tv_sec, tmout->tv_usec);
 1863                 else 
   ...
 1872          *              1) Sending a frag 
 1873          * OR   2) Received *part* of an incoming frag from the daemon 
 1874          * OR   3) Wantmore is true 
 1875          * OR   4) Need the current OGM to complete its asynch send 
 1876          * OR   5) We haven't probed at least once for incoming packets 
 1877          *
 1878          * wantmore is initialized to  TRUE  -> loop exec'ed at least once 
 1879         */ 
 1880  
 1881  
 1882         while (txfp || topvmd->tt_rxf || wantmore || waitForOgmToComplete 
 1883                         || !probedForIncomingPkts 
 1884         )  
 1885         {
 1886  
 1887                 totfr = 0;  
 1888  
 1889                 /* Either we are sending something, or have a partial recv'd frag */ 
 1890                 if (txfp || topvmd->tt_rxf)                     /* gotta block */ 
 1891                 {
 1892                         /* must block if sending any message, or receiving from pvmd */ 
 1893                         tvp = (struct timeval *) NULL;
 1894  
 1895                 }  
 1896                 else 
 1897                 {
 1898                         if (wantmore)  
 1899                         {
 1900                                 /* Calculate how long to wait inside the "select"
 1901                                  *      tval = NULL means wait forever 
 1902                                  *  tval = (0,0) means probe 
 1903                                  *      tval = (x,y) means wait at most x sec + y usec 
 1904                                 */ 
 1905  
 1906                                 if (tmout)                                      /* finite time to block */ 
 1907                                 {
 1908                                         pvmgetclock(&tnow);
 1909                                         TVXSUBY(&tnow, &tnow, &tin);
 1910                                         if (TVXLTY(tmout, &tnow))       /* time's up */ 
 1911                                         {
 1912                                                 TVCLEAR(&tnow);
 1913                                                 wantmore = 0;
 1914                                         }  
 1915                                         else 
 1916                                         {
 1917                                                 TVXSUBY(&tnow, tmout, &tnow);
 1918                                         }
 1919                                         tvp = &tnow;
 1920                                 }  
 1921                                 else 
 1922                                 {                                               /* forever to block */ 
 1923                                         tvp = (struct timeval *) NULL;
 1924                                 }
 1925  
 1926                         }  
 1927                         else 
 1928                         {                                                       /* return asap */ 
 1929                                 TVCLEAR(&tnow);
 1930                                 tvp = &tnow;
 1931                         }
 1932                 }
 1933  
 1934                 /* Here we are setting the read and write file descriptors for 
 1935                  *      the following select statement.  
 1936                 */ 
 1937  
 1938  
 1939 #if !defined(IMA_MPP)
 1940                 rfds = pvmrfds;
 1941                 FD_ZERO(&wfds);
 1942                 if (txfp)
 1943                         FD_SET(txpcbp->tt_fd, &wfds);
 1944 #endif 
 1945  
 1946                 if (pvmdebmask & PDMSELECT) {
 1947                         if (tvp)
 1948                                 pvmlogprintf("mxfer() select timeout %d.%06d\n",
 1949                                                 tvp->tv_sec, tvp->tv_usec);
 1950                         else 
 1951                                 pvmlogprintf("mxfer() select timeout inf\n");
 1952 #if !defined(IMA_MPP)
 1953                         print_fdset("mxfer() rfds=", pvmnfds, &rfds);
wfds is uninitialized1954                         print_fdset("mxfer() wfds=", pvmnfds, &wfds);
     /kat0/fletcher/SATE/2010/pvm3/src/pvmcruft.c
     Enter mxfer / print_fdset
 1302   print_fdset(pad, n, f) 
 1303           char *pad;                      /* label at head */ 
 1304           int n;                          /* max fd + 1 */ 
 1305   #ifdef FDSETNOTSTRUCT 
 1306           fd_set *f;                      /* fd set */ 
 1307   #else 
 1308           struct fd_set *f;       /* fd set */ 
 1309   #endif 
 1310   {
 1311           int i;
 1312           char *s = "";
 1313    
 1314           pvmlogprintf("%s", pad);
 1315           for (i = 0; i < n; i++)
*f is uninitialized1316                   if (FD_ISSET(i, f)) {     /* Uninitialized Variable */
     Exit mxfer / print_fdset
Preconditions
pad = 0
&$unknown_1189797 >= 1
((char*)n)[4] = 0
topvmd->tt_rxf = 0
*n = 0
pvmnfds >= 1
tnow.tv_usec <= tin.tv_usec - 1
Postconditions
atnewline' = 0
bypassRead' = 0
f' = &wfds.__fds_bits[0]
gotem' = 0
i' = 0
inPlaceBodyLen' = 0
inPlaceHeader' = 0
n' = pvmnfds
newline' = 1
nfr' = 0
pad' = &#string52[0]
probe' = 1
probedForIncomingPkts' = 0
rfds.__fds_bits[0]' = pvmrfds.__fds_bits[0]
strlen(&rfds.__fds_bits[0])' = strlen(&pvmrfds.__fds_bits[0])
s' = &#string1[0]
sendmsg' = 0
tmbuf.tm_sec' = &$unknown_1189801
tnow.tv_sec' >= 0
tnow.tv_usec' = -1 * &$unknown_1189797 + 1000000
totfr' = 0
tvp' = &tnow.tv_sec
txcp' = 0
txfp' = 0
txpcbp' = 0
txtogo' = 0
waitForOgmToComplete' = 0
wantmore' = 1




Change Warning 344.29022 : Uninitialized Variable

Priority:
State:
Finding:
Owner:
Note: