From patchwork Thu Mar 10 12:04:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 8556691 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 20CD4C0553 for ; Thu, 10 Mar 2016 12:04:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41FD920376 for ; Thu, 10 Mar 2016 12:04:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 66F2720364 for ; Thu, 10 Mar 2016 12:04:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 522996E94F; Thu, 10 Mar 2016 12:04:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 17F636E94F; Thu, 10 Mar 2016 12:04:50 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 10 Mar 2016 04:04:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,315,1455004800"; d="scan'208";a="667012006" Received: from tcohen10-mobl3.ger.corp.intel.com (HELO ivy.ger.corp.intel.com) ([10.252.47.123]) by FMSMGA003.fm.intel.com with ESMTP; 10 Mar 2016 04:04:49 -0800 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Subject: [PATCH] drm: fix blob pointer check Date: Thu, 10 Mar 2016 12:04:21 +0000 Message-Id: <1457611461-9116-1-git-send-email-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.7.0 Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, Daniel Stone X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check properly that the allocated blob's pointer is valid. Signed-off-by: Lionel Landwerlin Reported-by: Dan Carpenter Cc: Daniel Stone Cc: Daniel Vetter Cc: Matt Roper Cc: dri-devel@lists.freedesktop.org Reviewed-by: Daniel Stone --- drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 87d0b20..1caddb1 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2917,8 +2917,8 @@ void drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, blob = drm_property_create_blob(dev, sizeof(struct drm_color_lut) * size, NULL); - if (!blob) { - ret = -ENOMEM; + if (IS_ERR(blob)) { + ret = PTR_ERR(blob); goto fail; }