On 6/17/19 10:42 PM, Chaitanya Kulkarni wrote:
+inline const char *blk_op_str(int op)
+{
+ const char *op_str = "UNKNOWN";
+
+ if (op < ARRAY_SIZE(blk_op_name) && blk_op_name[op])
+ op_str = blk_op_name[op];
+
+ return op_str;
+}
This won't work correctly if op < 0. If you have another look at the
block layer debugfs code you will see that 'op' is has an unsigned type
in that code. Please either change the type of 'op' from 'int' to
'unsigned int' or change 'op < ARRAY_SIZE(blk_op_name)' into
'(unsigned)op < ARRAY_SIZE(blk_op_name)'.
Thanks,
Bart.