mtd: lpddr2_nvm: Fix possible null-ptr-deref
[ Upstream commit6bdd45d795] It will cause null-ptr-deref when resource_size(add_range) invoked, if platform_get_resource() returns NULL. Fixes:96ba9dd657("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>
This commit is contained in:
parent
effbf63616
commit
0919982a17
1 changed files with 2 additions and 0 deletions
|
|
@ -433,6 +433,8 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
|
|||
|
||||
/* lpddr2_nvm address range */
|
||||
add_range = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!add_range)
|
||||
return -ENODEV;
|
||||
|
||||
/* Populate map_info data structure */
|
||||
*map = (struct map_info) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue