From patchwork Thu Feb 28 11:18:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 159337 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp509919jad; Thu, 28 Feb 2019 03:19:03 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia5NfBvZ1HJLrIkp6RENcrZRjUo+Kgp9cXkMQb0S86ooq944BJBRTbQvev+NvLEdIUAEKS6 X-Received: by 2002:a63:460a:: with SMTP id t10mr7743922pga.354.1551352743620; Thu, 28 Feb 2019 03:19:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551352743; cv=none; d=google.com; s=arc-20160816; b=UfdsqI05JuQGw/Y5DzN4abNuFzgQeRX3gykIkZPUohHN7N9EqcdJWugGEBueaJxHu3 V+UEFVdFucnCsD3nqUGYjydX9ijPuXGSYf76f72e4IHPpImZcFuZOefF3mSiHkh3dP2W MWshKMoVodS6ebbgLBLEjZWHC1wNQ64a1laG/1sYbrOvkFCiSE6+mfHaiTEI3u617JE/ VtT4/j4+YmvlxOmmzJ9rvqxp0HqQc/UPBtsiFIktUfyx4BXTZtmooXk5NAhPSRPBzm0L K7pORcQQJ+n9oMKoMXqPFoqQGeDh3tFN+4yx8A2oWHJsoOtqcJB9yNdWzMHYGF0tvw9k iegw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=g6Ec3q0tvmd6ulgSH0aXcngd3WnTTHL3G1G62omSZGA=; b=0PbFUyI4dpvk7r5k1NuuwfiWnhrhkaQlZweak7xgQ0GFEuEtiBKiBR00mKrmMQOPis 6A7V5i6HpLziQYmyWEicJxiHTpqpnmMRaNykIEPhQLDzaVny8TgI91/vEZhk3TtpFX2L rvrZcXJun999UgqO35VOgrHVuaDaGaEFEni9pK5I5f4QrBHK8hOlGo0E/mjBGdEZuOyY NgallYRmmNk8hxZNNpn9YWC415+ccn8NjQzuW7G577EHWQA1l+WvpzPGQdczK3rA70Zg maWJQEak4jyjkJSJx1z9Uv8+DIw6fxZQx9SMm+Ei7XlnwK3/jy0GhP0zLLkZZGG7W/mA H2tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id c141si11660167pfb.199.2019.02.28.03.19.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 03:19:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F5756E169; Thu, 28 Feb 2019 11:18:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 509B66E15C for ; Thu, 28 Feb 2019 11:18:58 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1SBItk4068369; Thu, 28 Feb 2019 05:18:55 -0600 Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1SBIt19000473 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 28 Feb 2019 05:18:55 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Thu, 28 Feb 2019 05:18:54 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Thu, 28 Feb 2019 05:18:54 -0600 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1SBIp3S012077; Thu, 28 Feb 2019 05:18:53 -0600 From: Jyri Sarha To: Subject: [tiL4.19-AD PATCH 1/2] drm/tilcdc: Check drm_fb_cma_get_gem_obj() return value Date: Thu, 28 Feb 2019 13:18:50 +0200 Message-ID: <1b3ce6819beec9779468d1b661889d5b2dfa0c3e.1551352503.git.jsarha@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1551352735; bh=5r6QpsHWi0by8/zjrR/F4ja3Ax3lsIq0cPLCcE4WRHc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ncHp0HPKFiX+NNTE71bMre3MujoCcZmj4/+Pmmp4NNrUy85ko6LCeGpM6wQXpez7v K+sUu2QpYg207VuA2eqscjEZmb7CyrKTbHsf32nqbE2MlHNJssIxw+HZ8uNbPWf94O mJ07arJiu/8W37Cx+6Rl9Z4aYMdzvSZf4HWPykgA= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.ujfalusi@ti.com, tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_fb_cma_get_gem_obj() may return NULL. The return value needs to be checked before dereferencing the returned pointer. Signed-off-by: Jyri Sarha --- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 1067e702c22c..a8ae064f52bb 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -75,6 +75,8 @@ static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb) u64 dma_base_and_ceiling; gem = drm_fb_cma_get_gem_obj(fb, 0); + if (WARN_ON(!gem)) + return; start = gem->paddr + fb->offsets[0] + crtc->y * fb->pitches[0] +