public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing
@ 2019-05-09  3:07 Y.b. Lu
  2019-05-09  3:57 ` Richard Cochran
  2019-05-09 16:19 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Y.b. Lu @ 2019-05-09  3:07 UTC (permalink / raw)
  To: netdev@vger.kernel.org, Richard Cochran, David Miller
  Cc: Claudiu Manoil, Alexandru Marginean, Y.b. Lu

From: Claudiu Manoil <claudiu.manoil@nxp.com>

Make sure ptp dt node exists before accessing it in case
of NULL pointer call trace.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 drivers/ptp/ptp_qoriq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 53775362aac6..e10642403b25 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -467,6 +467,9 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
 	unsigned long flags;
 	u32 tmr_ctrl;
 
+	if (!node)
+		return -ENODEV;
+
 	ptp_qoriq->base = base;
 	ptp_qoriq->caps = *caps;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-09 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09  3:07 [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing Y.b. Lu
2019-05-09  3:57 ` Richard Cochran
2019-05-09 16:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox