소스 검색

mtd: onenand: add missing check

Coverity has reported that inside the function "onenand_block_by_block_erase()"
in onenand_base.c, we should add a check to prevent the incrementing of
possible NULL value for "region"

Signed-off-by: Maxin B. John <john.maxin@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
john.maxin@nokia.com 14 년 전
부모
커밋
eff3bba61f
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      drivers/mtd/onenand/onenand_base.c

+ 1 - 1
drivers/mtd/onenand/onenand_base.c

@@ -2453,7 +2453,7 @@ static int onenand_block_by_block_erase(struct mtd_info *mtd,
 		len -= block_size;
 		len -= block_size;
 		addr += block_size;
 		addr += block_size;
 
 
-		if (addr == region_end) {
+		if (region && addr == region_end) {
 			if (!len)
 			if (!len)
 				break;
 				break;
 			region++;
 			region++;