From patchwork Wed May 2 09:11:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 134825 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp448739lji; Wed, 2 May 2018 02:12:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrd2roYH3j7RcI7K4cPmZuDQFV++kJlCrbT8tI/nvpO5z89U+sQilZHzWQJwVQldTq4P1Gy X-Received: by 2002:a63:6502:: with SMTP id z2-v6mr6445810pgb.159.1525252367593; Wed, 02 May 2018 02:12:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525252367; cv=none; d=google.com; s=arc-20160816; b=fqG6FtG1VmEy3H+e7ia4mt5A5aWd3TDSYF8Jel17cUCCw4gKbA8dCx+y51Zm4iZ7Wr 1ybD5XV8mRUELq3PFxrhMfqTP/erQKWBBa/mHA7g1uAwO81aK+OdcnQyMis/m314bA+e 3G4JEEXFbnHZJDqkFPCo42Wrd9xT0eKrjknKmxj857WUvkJBaztRZQClweMzoTS0OLYN jHGtqISYiX8KRUaqe4ofU7ubjRH7eiF+Ntzw51HbqehCdyJlBe8WSZimYUcqtlUmlDDB JCvSmKLceKqetMuNgnyl0TsagkRqdecgz/lwAsCbE3AnlsbX9ELZS8pA4gm1jrLyh45b SBtQ== 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:dkim-signature:delivered-to :arc-authentication-results; bh=GGB+/yIbtLnNnYdpFZWwL8vrqLpJLD9auuu7QxRXC3E=; b=q6p5YhTZ3XxidlDw85/wE31v0X7fO3D5UBtEETQC0joQqLuVwpbdU5xA7sbFw/Uic5 n761ZFmLZhPv0+mk6bD+F3WRLH2+JmsVWEFRUWZuYVsWGyWrQCbXblxZO7pZ6bOYwyjg GqKga/LQ6O6PMvb1EpJs4knHP1mGix/yLXeo8dHTZuekrDC2krWp+kZkulgYgWktt8fn jrFcs0DtYCytAM3I1bnOkAdFtYVpiQk3wgLIRxsBwdogGiqUhni8oiH1IJrXbpur79+4 Emq9/dtefoh2trtaj70Jhv6fWBnslLC/5E9mgQzhnG1luJp6rJrFIqQpwbs9l+K16LW+ qu5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=jDjpJpgX; 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 9-v6si11166357plf.283.2018.05.02.02.12.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 May 2018 02:12:47 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=jDjpJpgX; 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 14BED6E537; Wed, 2 May 2018 09:12:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 046BF6E52C for ; Wed, 2 May 2018 09:12:10 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w429C7VE021716; Wed, 2 May 2018 04:12:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1525252327; bh=fpdzhi5aShM58IDrSQg8gtQdvPu87Qc2RQxSlHQ3LU8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jDjpJpgX2njlgt1xdwjQ1m0jVL8LLno+FfkBIiAJmuR9dJ/TBFgOsuo4YX9llPEKS MEjAc07mvf1I9njkHw36f4ij9DriZYhpCi9gqMqyJtchYDyezd5uvPbRaRKM5kMEJA B/yYNHA+B0iiMlxjoR5IoNDS7ASrrFW9AblWxAf4= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w429C7UO013149; Wed, 2 May 2018 04:12:07 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 2 May 2018 04:12:06 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 2 May 2018 04:12:07 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w429C3GH015655; Wed, 2 May 2018 04:12:06 -0500 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCH 2/4] drm/omap: handle error if scale coefs are not found Date: Wed, 2 May 2018 12:11:57 +0300 Message-ID: <20180502091159.7071-3-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180502091159.7071-1-tomi.valkeinen@ti.com> References: <20180502091159.7071-1-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If get_scale_coef functions fail, they return NULL, but we never check the return value and could do a NULL deref. This should not happen as we ought to validate the amount of scaling already earlier, but to be safe, add the necessary check. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 5e2e65e88847..b8fdb63e5bb3 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -828,6 +828,12 @@ static void dispc_ovl_set_scale_coef(struct dispc_device *dispc, h_coef = dispc_ovl_get_scale_coef(fir_hinc, true); v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps); + if (!h_coef || !v_coef) { + dev_err(&dispc->pdev->dev, "%s: failed to find scale coefs\n", + __func__); + return; + } + for (i = 0; i < 8; i++) { u32 h, hv;