Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Redundant Condition  at pmsg.c:612

Categories: LANG.STRUCT.RC CWE:570 CWE:571
Warning ID: 2621.2661
Procedure: bytepk
Trace: View
Modified: Wed Sep 2 12:42:21 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/pmsg.c
   Enter bytepk
 575 bytepk(mp, cp, num, siz, lnc) 
 576         struct pmsg *mp;
 577         char *cp;                       /* base of data */ 
 578         int num;                        /* num of chunks */ 
 579         int siz;                        /* size of chunk */ 
 580         int lnc;                        /* lead to next chunk */ 
 581 {
 582         struct frag *fp;                        /* working frag */ 
 583         int togo;                                       /* bytes left in chunk */ 
 584         int r;                                          /* bytes (space) left in frag */ 
 585  
 586         if (siz == lnc) {               /* if contiguous, treat as single chunk */ 
 587                 lnc = (siz *= num);
 588                 num = 1;
 589         }
 590         lnc -= siz;             /* now bytes between chunks */ 
 591  
 592         while (num-- > 0) {             /* copy chunks until done */ 
 593  
 594                 for (togo = siz; togo > 0; ) {
 595                         fp = mp->m_frag->fr_rlink;
 596                         r = fp->fr_max - (fp->fr_dat - fp->fr_buf) - fp->fr_len;
 597  
 598                         if (togo <= r) {        /* space in frag for entire chunk */ 
 599                                 BCOPY(cp, fp->fr_dat + fp->fr_len, togo);
 600                                 fp->fr_len += togo;
 601                                 cp += togo;
 602                                 togo = 0;
 603  
 604                         } else {
 605                                 if (r > 0) {    /* space for part of chunk */ 
 606                                         BCOPY(cp, fp->fr_dat + fp->fr_len, r);
 607                                         fp->fr_len += r;
 608                                         togo -= r;
 609                                         cp += r;
 610  
 611                                 } else {                /* no space, add new frag */ 
Never True: r != 0612                                         if (r = pmsg_extend(mp))     /* Redundant Condition */
 613                                                 return r;   /* Unreachable Data Flow (ID: 2622.2662) */
 614                                 }
 615                         }
 616                 }
 617                 cp += lnc;
 618         }
 619         return 0;
 620 




Change Warning 2621.2661 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: