From: Laurent Pinchart Date: Tue, 24 Dec 2013 11:58:01 +0000 (+0100) Subject: drm/omap: Don't dereference list head when the connectors list is empty X-Git-Tag: v3.15-rc1~51^2~15^2 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=06fb220b2d1a80be5621fa06ef276a3890e6be78;p=linux.git drm/omap: Don't dereference list head when the connectors list is empty 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 Reviewed-by: Rob Clark Signed-off-by: Rob Clark --- diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c index f466c4aaee94..19a9b8613620 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c @@ -306,7 +306,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) {