提交 e5b3eceb 编写于 作者: M Manuel Pégourié-Gonnard 提交者: Greg Kroah-Hartman

staging: mt29f: fix unchecked malloc()

The pointer is unconditionally dereferenced a few lines later, we need to make
sure it isn't NULL.
Signed-off-by: NManuel Pégourié-Gonnard <mpg@elzevir.fr>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 c5af6be3
...@@ -483,8 +483,11 @@ static int spinand_program_page(struct spi_device *spi_nand, ...@@ -483,8 +483,11 @@ static int spinand_program_page(struct spi_device *spi_nand,
#ifdef CONFIG_MTD_SPINAND_ONDIEECC #ifdef CONFIG_MTD_SPINAND_ONDIEECC
unsigned int i, j; unsigned int i, j;
enable_read_hw_ecc = 0;
wbuf = devm_kzalloc(&spi_nand->dev, CACHE_BUF, GFP_KERNEL); wbuf = devm_kzalloc(&spi_nand->dev, CACHE_BUF, GFP_KERNEL);
if (!wbuf)
return -ENOMEM;
enable_read_hw_ecc = 0;
spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf); spinand_read_page(spi_nand, page_id, 0, CACHE_BUF, wbuf);
for (i = offset, j = 0; i < len; i++, j++) for (i = offset, j = 0; i < len; i++, j++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册