* [PATCH] drm/omap: Don't dereference list head when the connectors list is empty
@ 2013-12-23 15:27 Laurent Pinchart
2013-12-23 18:04 ` Rob Clark
2013-12-24 6:35 ` Archit Taneja
0 siblings, 2 replies; 4+ messages in thread
From: Laurent Pinchart @ 2013-12-23 15:27 UTC (permalink / raw)
To: dri-devel
The connectors list iterator returns the list head when the list is
empty. Fix it by returning NULL in that case.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/gpu/drm/omapdrm/omap_fb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index f2b8f06..1b48cf2 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -301,8 +301,11 @@ struct drm_connector *omap_framebuffer_get_next_connector(
struct list_head *connector_list = &dev->mode_config.connector_list;
struct drm_connector *connector = from;
- if (!from)
+ if (!from) {
+ if (list_empty(connector_list))
+ return NULL;
return list_first_entry(connector_list, typeof(*from), head);
+ }
list_for_each_entry_from(connector, connector_list, head) {
if (connector != from) {
--
1.8.3.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/omap: Don't dereference list head when the connectors list is empty
2013-12-23 15:27 [PATCH] drm/omap: Don't dereference list head when the connectors list is empty Laurent Pinchart
@ 2013-12-23 18:04 ` Rob Clark
2013-12-23 18:15 ` Laurent Pinchart
2013-12-24 6:35 ` Archit Taneja
1 sibling, 1 reply; 4+ messages in thread
From: Rob Clark @ 2013-12-23 18:04 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: dri-devel
On Mon, Dec 23, 2013 at 10:27 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> The connectors list iterator returns the list head when the list is
> empty. Fix it by returning NULL in that case.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Thanks
Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
> drivers/gpu/drm/omapdrm/omap_fb.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
> index f2b8f06..1b48cf2 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -301,8 +301,11 @@ struct drm_connector *omap_framebuffer_get_next_connector(
> struct list_head *connector_list = &dev->mode_config.connector_list;
> struct drm_connector *connector = from;
>
> - if (!from)
> + if (!from) {
> + if (list_empty(connector_list))
> + return NULL;
> return list_first_entry(connector_list, typeof(*from), head);
> + }
>
> list_for_each_entry_from(connector, connector_list, head) {
> if (connector != from) {
> --
> 1.8.3.2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/omap: Don't dereference list head when the connectors list is empty
2013-12-23 18:04 ` Rob Clark
@ 2013-12-23 18:15 ` Laurent Pinchart
0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2013-12-23 18:15 UTC (permalink / raw)
To: Rob Clark; +Cc: dri-devel
Hi Rob,
On Monday 23 December 2013 13:04:15 Rob Clark wrote:
> On Mon, Dec 23, 2013 at 10:27 AM, Laurent Pinchart
>
> <laurent.pinchart@ideasonboard.com> wrote:
> > The connectors list iterator returns the list head when the list is
> > empty. Fix it by returning NULL in that case.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Thanks
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
Thank you. Could you please take this in your tree, or make sure that Dave
picks the patch from the list ?
> > ---
> >
> > drivers/gpu/drm/omapdrm/omap_fb.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c
> > b/drivers/gpu/drm/omapdrm/omap_fb.c index f2b8f06..1b48cf2 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> > @@ -301,8 +301,11 @@ struct drm_connector
> > *omap_framebuffer_get_next_connector(>
> > struct list_head *connector_list =
> > &dev->mode_config.connector_list;
> > struct drm_connector *connector = from;
> >
> > - if (!from)
> > + if (!from) {
> > + if (list_empty(connector_list))
> > + return NULL;
> > return list_first_entry(connector_list, typeof(*from),
> > head);
> > + }
> >
> > list_for_each_entry_from(connector, connector_list, head) {
> > if (connector != from) {
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/omap: Don't dereference list head when the connectors list is empty
2013-12-23 15:27 [PATCH] drm/omap: Don't dereference list head when the connectors list is empty Laurent Pinchart
2013-12-23 18:04 ` Rob Clark
@ 2013-12-24 6:35 ` Archit Taneja
1 sibling, 0 replies; 4+ messages in thread
From: Archit Taneja @ 2013-12-24 6:35 UTC (permalink / raw)
To: Laurent Pinchart, dri-devel
Hi,
On Monday 23 December 2013 08:57 PM, Laurent Pinchart wrote:
> The connectors list iterator returns the list head when the list is
> empty. Fix it by returning NULL in that case.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/gpu/drm/omapdrm/omap_fb.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
> index f2b8f06..1b48cf2 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -301,8 +301,11 @@ struct drm_connector *omap_framebuffer_get_next_connector(
> struct list_head *connector_list = &dev->mode_config.connector_list;
> struct drm_connector *connector = from;
>
> - if (!from)
> + if (!from) {
> + if (list_empty(connector_list))
> + return NULL;
> return list_first_entry(connector_list, typeof(*from), head);
looks like there is a list function which does that too:
list_first_entry_or_null()
We could probably replace it with this.
Archit
> + }
>
> list_for_each_entry_from(connector, connector_list, head) {
> if (connector != from) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-24 6:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-23 15:27 [PATCH] drm/omap: Don't dereference list head when the connectors list is empty Laurent Pinchart
2013-12-23 18:04 ` Rob Clark
2013-12-23 18:15 ` Laurent Pinchart
2013-12-24 6:35 ` Archit Taneja
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.