From patchwork Mon Nov 19 09:44:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 12916 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7629F23E08 for ; Mon, 19 Nov 2012 09:51:18 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 27A8DA186A3 for ; Mon, 19 Nov 2012 09:51:18 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so6161934iej.11 for ; Mon, 19 Nov 2012 01:51:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=YQqUpvxXIzIsmJhWSunvmwJ96oh2PWNZ301nKB+xKds=; b=Q8XO9ewKVQS53JaGKd17T8r6aPmIZk/jjxMSaNJWIDCxc26D7pCUVg32GzB8YueLch CO/s/Fv4Hw8dNWogFKiq7AOIT27q7UMWHf5t8byMLPLeGZYTcxoSYf7YAgwgu79SLTC/ jfl9c8lRYLC3Edplw3H978joxVLnFyXmvG2IsKwANv3bcwvUpYbij5W4VXtn/cNEhG9B iTqMqgZvCP0iXJ+3CsTJbUac8V83+EwFk2XspaFIdV/hx+0431SeZz8WKKPiMtgz15Pc Gp49KltJsV4n6HN98Kt+NRPA25Pu2dCR3/xXeryP1fegbktrVEqc+lC+0pHsSOlzcUgb lgdQ== Received: by 10.50.213.34 with SMTP id np2mr6018728igc.57.1353318677898; Mon, 19 Nov 2012 01:51:17 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp135909igt; Mon, 19 Nov 2012 01:51:17 -0800 (PST) Received: by 10.66.79.167 with SMTP id k7mr34473631pax.24.1353318677066; Mon, 19 Nov 2012 01:51:17 -0800 (PST) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx.google.com with ESMTPS id np6si13154538pbc.59.2012.11.19.01.51.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Nov 2012 01:51:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.54; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pb0-f54.google.com with SMTP id wz12so3490868pbc.13 for ; Mon, 19 Nov 2012 01:51:16 -0800 (PST) Received: by 10.68.129.227 with SMTP id nz3mr31516022pbb.111.1353318676845; Mon, 19 Nov 2012 01:51:16 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id l4sm3180099paw.15.2012.11.19.01.51.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Nov 2012 01:51:16 -0800 (PST) From: Sachin Kamat To: dri-devel@lists.freedesktop.org Cc: airlied@linux.ie, airlied@gmail.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/4] drm/crtc: Fix potential NULL pointer dereference Date: Mon, 19 Nov 2012 15:14:57 +0530 Message-Id: <1353318299-3662-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353318299-3662-1-git-send-email-sachin.kamat@linaro.org> References: <1353318299-3662-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQlIXSXP3XaaF1x8fJqK21ERiMrU3ygvsnuih4hpRtxtMGnoovv2CWQnZQoXFcn/F+Z7gSWv drm_property_create_blob() could return NULL in which case NULL pointer dereference error (on connector->edid_blob_ptr) is possible. Return if connector->edid_blob_ptr is NULL. Fixes the following smatch error: drivers/gpu/drm/drm_crtc.c:3186 drm_mode_connector_update_edid_property() error: potential null dereference 'connector->edid_blob_ptr'. (drm_property_create_blob returns null) Signed-off-by: Sachin Kamat --- drivers/gpu/drm/drm_crtc.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 807336a..9337ce3 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -3186,6 +3186,8 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, size = EDID_LENGTH * (1 + edid->extensions); connector->edid_blob_ptr = drm_property_create_blob(connector->dev, size, edid); + if (!connector->edid_blob_ptr) + return -EINVAL; ret = drm_connector_property_set_value(connector, dev->mode_config.edid_property,