]> git.baikalelectronics.ru Git - kernel.git/commit
lightnvm: fix out-of-bounds write to array devices->info[]
authorColin Ian King <colin.king@canonical.com>
Fri, 16 Oct 2020 14:33:51 +0000 (15:33 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 16 Oct 2020 15:28:45 +0000 (09:28 -0600)
commit71f4f1bd0eba3f3f9410165c874738b9c553a884
tree0cfe505940239ea23f57eca478376dd0ec3b9f72
parent9630c3167c26c7d99187c7a32c79e93ac9b60c4a
lightnvm: fix out-of-bounds write to array devices->info[]

There is an off-by-one array check that can lead to a out-of-bounds
write to devices->info[i].  Fix this by checking by using >= rather
than > for the size check. Also replace hard-coded array size limit
with ARRAY_SIZE on the array.

Addresses-Coverity: ("Out-of-bounds write")
Fixes: 006c31efd2a5 ("lightnvm: Support for Open-Channel SSDs")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/core.c