Text  |   XML   |   Visible Warnings:

Pvm : Pvm analysis 1 : Redundant Condition  at tdpro.c:2908

Categories: LANG.STRUCT.RC CWE:570 CWE:571
Warning ID: 2743.2798
Procedure: tm_shmconn
Trace: View
Modified: Wed Sep 2 12:44:47 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/tdpro.c
   Enter tm_shmconn
 2888 tm_shmconn(tp, mp) 
 2889         struct task *tp;
 2890         struct pmsg *mp;        /* remember no return message */ 
 2891 {
 2892         int tid;                        
 2893         int pid;                                                /* real pid of task */ 
 2894         int ppid;                                               /* probable pid */ 
 2895         struct task *tp2;                               /* to search for real context */ 
 2896         struct pmsg *mp2;
 2897         int cc;
 2898         char c;
 2899         int dummy_true = 1;                             /* not so harsh "always true"? */ 
 2900  
 2901         if ( upkint( mp, &ppid ) ) {
 2902                 pvmlogerror( 
 2903                                 "tm_shmconn() bad msg format. Missing Unix pid??\n);
 2904                 goto bail;
 2905         }
 2906  
 2907 #ifndef SHMEM 
Always True: dummy_true != 02908         if ( dummy_true ) {     /* Redundant Condition */
 2909                 pvmlogerror( "tm_shmconn() shmem conn on non shmem sys? " );
 2910                 pvmlogerror( "Bit bucket...\n);
 2911                 goto bail;
 2912         }
 2913 #endif 
 2914          
 2915         /*
 2916         *       Task should already have a correct task struct.
 2917         *       Because TM_SHMCONN is passed after the shmem connect phase 
 2918         *       in pvmbeatask() in lpvmshmem.c 
 2919         */ 
 2920  
 2921         if ( tp2 = task_findpid( ppid ) )   /* Unreachable Call (ID: 2744.2799) */
 2922         {
 2923                 if ( pvmdebmask & PDMTASK ) {
 2924                         pvmlogprintf( 
 2925                                         "tm_shmconn() reconnect task t%x via sockets\n",
 2926                                         tp2->t_tid);
 2927                 }
 2928                 /* tp->t_sched = tp2->t_sched; */ 
 2929         }
 2930         else 
 2931         {
 2932                 pvmlogerror( "tm_shmconn() conn from non shmem connd task?\n");
 2933                 goto bail;              
 2934         }
 2935  
 2936         /*  
 2937          * tp2 is now the real task....  
 2938          * So we now update it with the correct socket descripter and then 
 2939          * mark the shadow one as dead.
 2940          *
 2941          */ 
 2942  
 2943         tp2->t_sock = tp->t_sock;
 2944  
 2945         tp->t_sock = -1;        /* tp will be freed by loclinput() */ 
 2946         tp->t_rxp = 0;
 2947         tp->t_flag |= TF_CLOSE; /* stop work() complaining - dead socket? */ 
 2948  
 2949         /*
 2950          *      kick it in the butt; it's ready to go 
 2951          */ 
 2952  
 2953         /* We are happy to mark it as a shared memory connected process */ 
 2954         /* i.e. please use shmem (mpp_output) not my socket to talk to me */ 
 2955  
 2956         /* the PRESHMCONN flag indicates that messages with MM_PRIO can be 
 2957                 sent over shared memory, but no others.  tm_getopt will 
 2958                 set the flag to SHMCONN 
 2959         */ 
 2960         tp2->t_flag |= TF_PRESHMCONN;
 2961  
 2962         return 0;
 2963  
 2964 bail
 2965         /* i.e. kill it! */ 
 2966         tp->t_sock = -1;        /* tp will be freed by loclinput() */ 
 2967         tp->t_rxp = 0;
 2968         tp->t_flag |= TF_CLOSE;
 2969         return 0;
 2970 




Change Warning 2743.2798 : Redundant Condition

Priority:
State:
Finding:
Owner:
Note: