MTD: Coverity defect cleanup: MTD [1/1]

PD#SWPL-13991

Problem:
Out-of-bounds read in get_free_node

Solution:
fix the issue

Verify:
AXG400

Change-Id: I6e41caf3b3118d524218d6023fb51df692865cba
Signed-off-by: xianjun.liu <xianjun.liu@amlogic.com>
This commit is contained in:
xianjun.liu
2019-09-16 15:56:11 +08:00
committed by Luke Go
parent 6e0b454867
commit 2c1b501094

View File

@@ -44,7 +44,7 @@ static struct free_node_t *get_free_node(struct mtd_info *mtd)
index = find_first_zero_bit((void *)&aml_chip->freeNodeBitmask,
RESERVED_BLOCK_NUM);
if (index > RESERVED_BLOCK_NUM) {
if (index >= RESERVED_BLOCK_NUM) {
pr_info("%s %d: index is greater than max! error",
__func__, __LINE__);
return NULL;