From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH] drm/omap: Don't dereference list head when the connectors list is empty Date: Mon, 23 Dec 2013 19:15:16 +0100 Message-ID: <32276855.3vUhbVWhQQ@avalon> References: <1387812473-31696-1-git-send-email-laurent.pinchart@ideasonboard.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [95.142.166.194]) by gabe.freedesktop.org (Postfix) with ESMTP id E887AFB4AB for ; Mon, 23 Dec 2013 10:14:52 -0800 (PST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Rob Clark Cc: "dri-devel@lists.freedesktop.org" List-Id: dri-devel@lists.freedesktop.org Hi Rob, On Monday 23 December 2013 13:04:15 Rob Clark wrote: > On Mon, Dec 23, 2013 at 10:27 AM, 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 > > Thanks > > Signed-off-by: Rob Clark 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