mtd: lpddr2_nvm: Fix possible null-ptr-deref
authorHui Tang <tanghui20@huawei.com>
Mon, 14 Nov 2022 09:02:40 +0000 (17:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:12 +0000 (13:32 +0100)
commitc4cc41e94d8357f5f02b8ef40257bb23931d8438
treed81c71a0c496435970228cc8afd093184ba59a64
parentfee1df5a5835e235ed33e0c5e05008f6e597f2f0
mtd: lpddr2_nvm: Fix possible null-ptr-deref

[ Upstream commit 6bdd45d795adf9e73b38ced5e7f750cd199499ff ]

It will cause null-ptr-deref when resource_size(add_range) invoked,
if platform_get_resource() returns NULL.

Fixes: 96ba9dd65788 ("mtd: lpddr: add driver for LPDDR2-NVM PCM memories")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20221114090240.244172-1-tanghui20@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/lpddr/lpddr2_nvm.c