* [PATCH 1/1] drm/gma500: mdfld: avoid possible null pointer dereference
@ 2016-05-18 20:31 Heinrich Schuchardt
2016-05-18 20:51 ` Patrik Jakobsson
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2016-05-18 20:31 UTC (permalink / raw)
To: Patrik Jakobsson, David Airlie
Cc: dri-devel, linux-kernel, Heinrich Schuchardt
Only dereference sender after checking if sender is NULL.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
index 1616af2..c50534c 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
@@ -520,7 +520,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs)
{
unsigned long flags;
- struct drm_device *dev = sender->dev;
+ struct drm_device *dev;
int i;
u32 gen_data_reg;
int retry = MDFLD_DSI_READ_MAX_COUNT;
@@ -530,6 +530,8 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
return -EINVAL;
}
+ dev = sender->dev;
+
/**
* do reading.
* 0) send out generic read request
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] drm/gma500: mdfld: avoid possible null pointer dereference
2016-05-18 20:31 [PATCH 1/1] drm/gma500: mdfld: avoid possible null pointer dereference Heinrich Schuchardt
@ 2016-05-18 20:51 ` Patrik Jakobsson
0 siblings, 0 replies; 3+ messages in thread
From: Patrik Jakobsson @ 2016-05-18 20:51 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: David Airlie, dri-devel, linux-kernel
On Wed, May 18, 2016 at 10:31 PM, Heinrich Schuchardt
<xypron.glpk@gmx.de> wrote:
> Only dereference sender after checking if sender is NULL.
Hi Heinrich
I think we had a patch that did something similar a while ago. Don't
remember what happened to it. We do check for !sender right before
calling this function (at only one call-site) so it cannot be NULL at
this point. I would be ok with your change if you also remove the
extra checks in mdfld_dsi_read_mcs(). That way we don't double check
and we check at the point where it actually matters.
Thanks
Patrik
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> index 1616af2..c50534c 100644
> --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> @@ -520,7 +520,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
> u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs)
> {
> unsigned long flags;
> - struct drm_device *dev = sender->dev;
> + struct drm_device *dev;
> int i;
> u32 gen_data_reg;
> int retry = MDFLD_DSI_READ_MAX_COUNT;
> @@ -530,6 +530,8 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
> return -EINVAL;
> }
>
> + dev = sender->dev;
> +
> /**
> * do reading.
> * 0) send out generic read request
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] drm/gma500: mdfld: avoid possible null pointer dereference
@ 2016-05-18 20:51 ` Patrik Jakobsson
0 siblings, 0 replies; 3+ messages in thread
From: Patrik Jakobsson @ 2016-05-18 20:51 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: linux-kernel, dri-devel
On Wed, May 18, 2016 at 10:31 PM, Heinrich Schuchardt
<xypron.glpk@gmx.de> wrote:
> Only dereference sender after checking if sender is NULL.
Hi Heinrich
I think we had a patch that did something similar a while ago. Don't
remember what happened to it. We do check for !sender right before
calling this function (at only one call-site) so it cannot be NULL at
this point. I would be ok with your change if you also remove the
extra checks in mdfld_dsi_read_mcs(). That way we don't double check
and we check at the point where it actually matters.
Thanks
Patrik
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> index 1616af2..c50534c 100644
> --- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
> @@ -520,7 +520,7 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
> u8 *data, u16 len, u32 *data_out, u16 len_out, bool hs)
> {
> unsigned long flags;
> - struct drm_device *dev = sender->dev;
> + struct drm_device *dev;
> int i;
> u32 gen_data_reg;
> int retry = MDFLD_DSI_READ_MAX_COUNT;
> @@ -530,6 +530,8 @@ static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type,
> return -EINVAL;
> }
>
> + dev = sender->dev;
> +
> /**
> * do reading.
> * 0) send out generic read request
> --
> 2.1.4
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-18 20:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-18 20:31 [PATCH 1/1] drm/gma500: mdfld: avoid possible null pointer dereference Heinrich Schuchardt
2016-05-18 20:51 ` Patrik Jakobsson
2016-05-18 20:51 ` Patrik Jakobsson
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.