[ofw] error when compiling ofed ulp\libibnetdisc

Hefty, Sean sean.hefty at intel.com
Mon Jul 26 09:22:30 PDT 2010


> When compiling the ulp\libibnetdisc  on OFW I got the following casting error. When looking the code
> it really looks problematic. I wonder how you don't see it in your environment.

I just checked, and this error doesn't show up in my build (7600.16385).

> static size_t _unmarshall16(uint8_t * inbuf, uint16_t * num)
> 
> {
> 
>                 (*num) = (uint64_t) inbuf[0];
> 
>                 (*num) |= ((uint16_t) inbuf[1] << 8);

The cast to uint64_t is wrong.  We can replace the above with:

	(*num) = ((uint16_t) inbuf[1] << 8) | inbuf[0];

- Sean



More information about the ofw mailing list