On 6/18/19 3:00 PM, Chaitanya Kulkarni wrote:
Regarding the correctness, I think if one of the operand is unsigned then signed values are converted to unsigned valued implicitly. However the exceptions is if the type of the operand with signed integer type can represent all of the values of the type of the operand with unsigned integer type, then the operand with unsigned integer type is converted to the type of the operand with signed integer type. I'm wondering how would above scenario occur when comparing int and size_t. (unless on a platform int can fit all the values into size_t). Since above comparison of the ARRAY_SIZE involves sizeof (size_t) type is a base unsigned integer value, even if op < 0 it will get converted into the unsigned and it will still work. Please correct me if I'm wrong.
Since a long comment was needed to explain this, that means that the mental effort for anyone who wants to verify the blk_op_str() code is large. Please make sure that kernel code is easy to read and to verify.
Thanks, Bart.