[ofa-general] Re: mlx4_ib_post_send(): incorrect test on wr->opcode?

Roland Dreier rdreier at cisco.com
Thu Apr 23 16:02:23 PDT 2009


 > wr->opcode cannot be less than 0, can it?

why not?  The struct field is signed, isn't it?  What prevents a
consumer from passing in a negative garbage value?

 > but note below that in mlx4_ib_opcodeIB_WR_RDMA_READ_WITH_INV is
 > missing, so shouldn't this be:

 > 		if (wr->opcode > IB_WR_FAST_REG_MR) {
 >                         err = -EINVAL;
 >                         goto out;
 >                 }

I don't understand the difference between explicitly saying
IB_WR_FAST_REG_MR and using ARRAY_SIZE(), except that if we add new
opcodes then the ARRAY_SIZE() way works without having to remember it.

It is true that if someone passes in IB_WR_RDMA_READ_WITH_INV, then the
mlx4 code won't return an error for that unimplemented operation, but I
don't see how your change fixes that (or indeed fixes anything).

 - R.



More information about the general mailing list