[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190318232434.9246-1-pakki001@umn.edu>
Date: Mon, 18 Mar 2019 18:24:34 -0500
From: Aditya Pakki <pakki001@....edu>
To: pakki001@....edu
Cc: kjlu@....edu, Stefan Agner <stefan@...er.ch>,
Boris Brezillon <bbrezillon@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
David Woodhouse <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Marek Vasut <marek.vasut@...il.com>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] mtd: rawnand: vf610: Fix to check for NULL pointer dereference
of_match_device can return NULL if there is no matching device is found.
The patch avoids a potential NULL pointer dereference by checking for the
return value and passing the error upstream.
Signed-off-by: Aditya Pakki <pakki001@....edu>
---
drivers/mtd/nand/raw/vf610_nfc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index a662ca1970e5..946abbb275c3 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -850,6 +850,8 @@ static int vf610_nfc_probe(struct platform_device *pdev)
}
of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev);
+ if (!of_id)
+ return -ENODEV;
nfc->variant = (enum vf610_nfc_variant)of_id->data;
for_each_available_child_of_node(nfc->dev->of_node, child) {
--
2.17.1
Powered by blists - more mailing lists