From patchwork Fri Feb 12 16:31:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Peres X-Patchwork-Id: 8293381 Return-Path: X-Original-To: patchwork-intel-gfx@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 34A6FC02AA for ; Fri, 12 Feb 2016 16:32:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 617B82010F for ; Fri, 12 Feb 2016 16:32:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 01FF620160 for ; Fri, 12 Feb 2016 16:32:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2996D6EB02; Fri, 12 Feb 2016 08:32:07 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id F1D196EB04 for ; Fri, 12 Feb 2016 08:32:05 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 12 Feb 2016 08:31:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,436,1449561600"; d="scan'208";a="744979578" Received: from linux.intel.com ([10.23.219.25]) by orsmga003.jf.intel.com with ESMTP; 12 Feb 2016 08:31:47 -0800 Received: from beast.fi.intel.com (unknown [10.237.72.70]) by linux.intel.com (Postfix) with ESMTP id 761D26A4002; Fri, 12 Feb 2016 09:19:38 -0800 (PST) From: Martin Peres To: intel-gfx@lists.freedesktop.org Date: Fri, 12 Feb 2016 18:31:25 +0200 Message-Id: <1455294689-29249-4-git-send-email-martin.peres@linux.intel.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1455294689-29249-1-git-send-email-martin.peres@linux.intel.com> References: <1455294689-29249-1-git-send-email-martin.peres@linux.intel.com> Subject: [Intel-gfx] [PATCH 3/7] sna: check for NULL before dereferencing a pointer X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.3 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 Caught by Klockwork and I genuinely can't tell if it is safe without it, especially since all the surrounding code is checking for NULL. Signed-off-by: Martin Peres --- src/sna/sna_accel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 71a6207..8ceb1e1 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -3688,7 +3688,8 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box, __FUNCTION__, priv->flush, priv->shm, priv->cpu, flags)); if ((flags & PREFER_GPU) == 0 && - (flags & (REPLACES | IGNORE_DAMAGE) || !priv->gpu_damage || !kgem_bo_is_busy(priv->gpu_bo))) { + (flags & (REPLACES | IGNORE_DAMAGE) || !priv->gpu_damage || + (priv->gpu_bo && !kgem_bo_is_busy(priv->gpu_bo)))) { DBG(("%s: try cpu as GPU bo is idle\n", __FUNCTION__)); goto use_cpu_bo; }