[ofw] [PATCH] Update libibmad and infiniband-diags

Leonid Keller leonid at mellanox.co.il
Thu Aug 18 01:11:29 PDT 2011


OK with me

> -----Original Message-----
> From: Hefty, Sean [mailto:sean.hefty at intel.com]
> Sent: Monday, August 15, 2011 8:20 PM
> To: Leonid Keller; Uri Habusha; ofw at lists.openfabrics.org
> Cc: Ira Weiny (weiny2 at llnl.gov)
> Subject: RE: [PATCH] Update libibmad and infiniband-diags
> 
> > After applying your patch we got a build break on free version of Win8.
> > It was a warning, something like "possible usage of uninitialized variable
> > 'mad' " in rpc.c#213
> > I made locally the following patch.
> > What do you think?
> 
> I think the compiler sounds brain dead.  :P
> 
> > (I understand that as far as 'redirect' is coded to be 1, 'mad' is to be
> > initialized. But compiler doesn't understand. :( )
> 
> I think I would go a step further and remove the redirect variable completely.
> If we replace the while loop with a do-while, I'm hoping that the
> compiler can at least figure that out.  Can you see if the patch below works
> for win8 (I don't have a build system for win8 myself)?  If it looks okay,
> I'll submit this to Ira (who's copied).
> 
> Fix build on win8
> 
> From: Sean Hefty <sean.hefty at intel.com>
> 
> The win8 compiler appears to be even more brain dead than its
> predecessor.  It complains of an uninitialized variable mad in
> rpc.c around line 213.  Fix this by removing the redirect
> variable and using do - while instead.
> 
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
>  src/rpc.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/rpc.c b/src/rpc.c
> index d20c321..19a5a70 100644
> --- a/src/rpc.c
> +++ b/src/rpc.c
> @@ -213,13 +213,12 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t *
> rpc,
>  {
>  	int status, len;
>  	uint8_t sndbuf[1024], rcvbuf[1024], *mad;
> -	int redirect = 1;
>  	ib_rpc_v1_t *rpcv1 = (ib_rpc_v1_t *)rpc;
>  	int error = 0;
> 
>  	if ((rpc->mgtclass & IB_MAD_RPC_VERSION_MASK) == IB_MAD_RPC_VERSION1)
>  		rpcv1->error = 0;
> -	while (redirect) {
> +	do {
>  		len = 0;
>  		memset(sndbuf, 0, umad_size() + IB_MAD_SIZE);
> 
> @@ -247,10 +246,10 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t *
> rpc,
>  			/* update dport for next request and retry */
>  			/* bail if redirection fails */
>  			if (redirect_port(dport, mad))
> -				redirect = 0;
> +				break;
>  		} else
> -			redirect = 0;
> -	}
> +			break;
> +	} while (1);
> 
>  	if ((rpc->mgtclass & IB_MAD_RPC_VERSION_MASK) == IB_MAD_RPC_VERSION1)
>  		rpcv1->error = error;
> 




More information about the ofw mailing list