All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vignesh Raghavendra <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH] misc: k3_avs: Fix possible NULL pointer deference
Date: Fri, 14 Feb 2020 17:52:17 +0530	[thread overview]
Message-ID: <20200214122217.24671-1-vigneshr@ti.com> (raw)

Its possible that k3_avs_priv is NULL because the driver may not have
been probed yet. Therefore check if pointer is valid before
dereferencing it.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/misc/k3_avs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index c19c3c0646b7..adaf75b7165d 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -190,6 +190,10 @@ int k3_avs_notify_freq(int dev_id, int clk_id, u32 freq)
 	struct k3_avs_privdata *priv = k3_avs_priv;
 	struct vd_data *vd;
 
+	/* Driver may not be probed yet */
+	if (!priv)
+		return -EINVAL;
+
 	for (vd = priv->vd_config->vds; vd->id >= 0; vd++) {
 		if (vd->dev_id != dev_id || vd->clk_id != clk_id)
 			continue;
-- 
2.25.0

             reply	other threads:[~2020-02-14 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 12:22 Vignesh Raghavendra [this message]
2020-02-17  4:44 ` [PATCH] misc: k3_avs: Fix possible NULL pointer deference Keerthy
2020-02-27  3:19 ` Lokesh Vutla

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=20200214122217.24671-1-vigneshr@ti.com \
    --to=vigneshr@ti.com \
    --cc=u-boot@lists.denx.de \
    /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.