[ofa-general] Re: [PATCH} libmlx4: poll cq tail pointer

Michael S. Tsirkin mst at dev.mellanox.co.il
Mon Jun 11 02:51:45 PDT 2007


> Quoting Eli Cohen <eli at mellanox.co.il>:
> Subject: [PATCH} libmlx4: poll cq tail pointer
> 
> cast to uint16_t is required before assigning.
> Consider the following example:
> wqe_index = 0, wq->tail = 0x1ffff. You'd expect wq->tail to be 0x20000
> but it will actually be 0x10000. The reason for this is that compiler
> upcasts the result of wqe_index - (uint16_t) wq->tail to unsigned which
> yields a large number and when added to the original value of tail it
> overflows and actually becomes 0x10000.
> 
> Signed-off-by: Eli Cohen <eli at mellanox.co.il>

And a similiar patch would be needed for kernel, would it not?
mthca does not seem to affected: it does all math on 32 bit integers.

-- 
MST



More information about the general mailing list