All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/omap: Don't dereference list head when the connectors list is empty
@ 2013-12-24 11:58 Laurent Pinchart
  2014-03-28 21:56 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2013-12-24 11:58 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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Changes since v1:

- Use list_first_entry_or_null

diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index f2b8f06..2c3acb3 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -302,7 +302,8 @@ struct drm_connector *omap_framebuffer_get_next_connector(
 	struct drm_connector *connector = from;
 
 	if (!from)
-		return list_first_entry(connector_list, typeof(*from), head);
+		return list_first_entry_or_null(connector_list, typeof(*from),
+						head);
 
 	list_for_each_entry_from(connector, connector_list, head) {
 		if (connector != from) {
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drm/omap: Don't dereference list head when the connectors list is empty
  2013-12-24 11:58 [PATCH v2] drm/omap: Don't dereference list head when the connectors list is empty Laurent Pinchart
@ 2014-03-28 21:56 ` Laurent Pinchart
  2014-03-28 23:37   ` Rob Clark
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2014-03-28 21:56 UTC (permalink / raw)
  To: Rob Clark; +Cc: dri-devel

Hi Rob,

On Tuesday 24 December 2013 12:58:01 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>

Could you please take this patch in your tree ?

> ---
>  drivers/gpu/drm/omapdrm/omap_fb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> Changes since v1:
> 
> - Use list_first_entry_or_null
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c
> b/drivers/gpu/drm/omapdrm/omap_fb.c index f2b8f06..2c3acb3 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -302,7 +302,8 @@ struct drm_connector
> *omap_framebuffer_get_next_connector( struct drm_connector *connector =
> from;
> 
>  	if (!from)
> -		return list_first_entry(connector_list, typeof(*from), head);
> +		return list_first_entry_or_null(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] 3+ messages in thread

* Re: [PATCH v2] drm/omap: Don't dereference list head when the connectors list is empty
  2014-03-28 21:56 ` Laurent Pinchart
@ 2014-03-28 23:37   ` Rob Clark
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Clark @ 2014-03-28 23:37 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Valkeinen, Tomi, Tomi Valkeinen, dri-devel

On Fri, Mar 28, 2014 at 5:56 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Rob,
>
> On Tuesday 24 December 2013 12:58:01 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>
>
> Could you please take this patch in your tree ?

Tomi has been sending pull-req's for omapdrm, so it should probably go
via his tree.

(Tomi, I'll be sending a pull-req in a couple days, so if you don't
have anything queued up for 3.15 it isn't a problem for me to toss
this in, fwiw)

In either case, the patch is:

Reviewed-by: Rob Clark <robdclark@gmail.com>

>
>> ---
>>  drivers/gpu/drm/omapdrm/omap_fb.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> Changes since v1:
>>
>> - Use list_first_entry_or_null
>>
>> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c
>> b/drivers/gpu/drm/omapdrm/omap_fb.c index f2b8f06..2c3acb3 100644
>> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
>> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
>> @@ -302,7 +302,8 @@ struct drm_connector
>> *omap_framebuffer_get_next_connector( struct drm_connector *connector =
>> from;
>>
>>       if (!from)
>> -             return list_first_entry(connector_list, typeof(*from), head);
>> +             return list_first_entry_or_null(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] 3+ messages in thread

end of thread, other threads:[~2014-03-28 23:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-24 11:58 [PATCH v2] drm/omap: Don't dereference list head when the connectors list is empty Laurent Pinchart
2014-03-28 21:56 ` Laurent Pinchart
2014-03-28 23:37   ` Rob Clark

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.