* [PATCH] misc: k3_avs: Fix possible NULL pointer deference
@ 2020-02-14 12:22 Vignesh Raghavendra
2020-02-17 4:44 ` Keerthy
2020-02-27 3:19 ` Lokesh Vutla
0 siblings, 2 replies; 3+ messages in thread
From: Vignesh Raghavendra @ 2020-02-14 12:22 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] misc: k3_avs: Fix possible NULL pointer deference
2020-02-14 12:22 [PATCH] misc: k3_avs: Fix possible NULL pointer deference Vignesh Raghavendra
@ 2020-02-17 4:44 ` Keerthy
2020-02-27 3:19 ` Lokesh Vutla
1 sibling, 0 replies; 3+ messages in thread
From: Keerthy @ 2020-02-17 4:44 UTC (permalink / raw)
To: u-boot
On 14/02/20 5:52 pm, Vignesh Raghavendra wrote:
> 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.
Reviewed-by: Keerthy <j-keerthy@ti.com>
>
> 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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] misc: k3_avs: Fix possible NULL pointer deference
2020-02-14 12:22 [PATCH] misc: k3_avs: Fix possible NULL pointer deference Vignesh Raghavendra
2020-02-17 4:44 ` Keerthy
@ 2020-02-27 3:19 ` Lokesh Vutla
1 sibling, 0 replies; 3+ messages in thread
From: Lokesh Vutla @ 2020-02-27 3:19 UTC (permalink / raw)
To: u-boot
On 14/02/20 5:52 PM, Vignesh Raghavendra wrote:
> 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>
Applied to u-boot-ti
Thanks and regards,
Lokesh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-27 3:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 12:22 [PATCH] misc: k3_avs: Fix possible NULL pointer deference Vignesh Raghavendra
2020-02-17 4:44 ` Keerthy
2020-02-27 3:19 ` Lokesh Vutla
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.