diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-06-20 13:45:05 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-06-20 20:26:04 +0300 |
commit | a1e79188628580465ac6d7a93a313336ee3364f1 (patch) | |
tree | c77e8c6c014a97674114c779134b82bdba497ece /block/blk-mq-debugfs.c | |
parent | 9c24c10a2c1e1bb478b6bb70612d9e885aee044f (diff) | |
download | linux-a1e79188628580465ac6d7a93a313336ee3364f1.tar.xz |
blk-mq-debugfs: Off by one in blk_mq_rq_state_name()
If rq_state == ARRAY_SIZE() then we read one element beyond the end of
the blk_mq_rq_state_name_array[] array.
Fixes: ec6dcf63c55c ("blk-mq-debugfs: Show more request state information")
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq-debugfs.c')
-rw-r--r-- | block/blk-mq-debugfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index ffa622366922..1c4532e92938 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -356,7 +356,7 @@ static const char *const blk_mq_rq_state_name_array[] = { static const char *blk_mq_rq_state_name(enum mq_rq_state rq_state) { - if (WARN_ON_ONCE((unsigned int)rq_state > + if (WARN_ON_ONCE((unsigned int)rq_state >= ARRAY_SIZE(blk_mq_rq_state_name_array))) return "(?)"; return blk_mq_rq_state_name_array[rq_state]; |