All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shailendra Verma <shailendra.v@samsung.com>
To: Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
	p.shailesh@samsung.com, ashish.kalra@samsung.com,
	Shailendra Verma <shailendra.v@samsung.com>,
	Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: [PATCH] Dma - Fix possible NULL derefrence.
Date: Fri, 27 Jan 2017 16:55:59 +0530	[thread overview]
Message-ID: <1485516359-4232-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170127112626epcas3p137caa1e5fdbf0bb07ae5f057bf819828@epcas3p1.samsung.com

of_match_device could return NULL, and so cause a NULL
pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/dma/mv_xor.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 23f7528..c25b3bb 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1323,7 +1323,10 @@ static int mv_xor_probe(struct platform_device *pdev)
 		const struct of_device_id *of_id =
 			of_match_device(mv_xor_dt_ids,
 					&pdev->dev);
+		if (!of_id) {
+			dev_err(&pdev->dev, "Error: No device match found\n");
+			return -ENODEV;
+		}
 		xordev->xor_type = (uintptr_t)of_id->data;
 	}
 
-- 
1.7.9.5

       reply	other threads:[~2017-01-27 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170127112626epcas3p137caa1e5fdbf0bb07ae5f057bf819828@epcas3p1.samsung.com>
2017-01-27 11:25 ` Shailendra Verma [this message]
2017-01-30 16:49   ` [PATCH] Dma - Fix possible NULL derefrence Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485516359-4232-1-git-send-email-shailendra.v@samsung.com \
    --to=shailendra.v@samsung.com \
    --cc=ashish.kalra@samsung.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.shailesh@samsung.com \
    --cc=shailendra.capricorn@gmail.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.