Received: by 10.213.65.68 with SMTP id h4csp69333imn; Wed, 21 Mar 2018 12:35:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELuEuBPSsQOoSPZ36LNMqXiTge64BL7BGDWOJxIbB9ClIqL/xSNyg3tJIUoyCzAeWQtoD9Cw X-Received: by 2002:a17:902:983:: with SMTP id 3-v6mr22402599pln.278.1521660914359; Wed, 21 Mar 2018 12:35:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521660914; cv=none; d=google.com; s=arc-20160816; b=jqGQzkU/gtnfGiMuWediZmVvxhO7gZssqwx6DEPUXMx2qQ+SGgXPI+dehz6ZVuDgfb eKNDAHyeTa52KWG1Gd8A1ssCtovgd6D8GRJnNhYq5DcNmMXHZtPN+08aOGgdI3mJ4vkM JwB/RpIjVgNtgI/K8fe/IYIGRunoFJk1Iw3mGnJNivZ39F7Hg1CioiqK1PmKxOqHWuUP gEjXELWWvGs67Sb4P/2hYxd35AR+CeZ0vVhzBvZBwmC/bWzJU7inlIbkiXr6XdznWaGs DDim/1zNsgunJdlsY9ODH680T6PmSXnknK32v6srl3uoXOO9DZJpbZqNHI96mfZIhuIN bYLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:arc-authentication-results; bh=VcHDrjB9a1FOSCxR1gakRup2fETbBvj0AWJc/hApARU=; b=mwxZKUxHf/qfzSEAglX0ruXNsxBcUto4ysEGSXg/2A0eEjpkWz2O85do2PKd7j1Vzx EVsif3F5CGmYJqZexTs8NNQljSv256JuvW5XIxHNsnHI9j1Ynqvuah3QMnJK1UMWTwo2 qECqF6S42ACLHeMYVd+UsBAooGGpiSIqhRiLXVo/tEVJt9A3jrh3wDIHuriUsAsOLRAH AlmYpfAVC5HpjY/cmXfIY/ZWmwjaLkS+2bvq22gIih1y0E1qRWkUurk+NJWB5pDcGiBi BrH2jPQTAEL+UNybKwswae7xKhyXpr7UrrSckRRv/8NSIs6NTSrNQd0malpQ0iM/RJyj S22A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e133si3514008pfh.410.2018.03.21.12.34.59; Wed, 21 Mar 2018 12:35:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753426AbeCUTda convert rfc822-to-8bit (ORCPT + 99 others); Wed, 21 Mar 2018 15:33:30 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:61512 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753167AbeCUTXe (ORCPT ); Wed, 21 Mar 2018 15:23:34 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 11111804-1500050 for multiple; Wed, 21 Mar 2018 19:23:26 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Colin Ian King , "Joe Perches" , "Zhenyu Wang" , "Zhi Wang" , "Jani Nikula" , "Joonas Lahtinen" , "Rodrigo Vivi" , "David Airlie" , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org From: Chris Wilson In-Reply-To: Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180321190653.3829-1-colin.king@canonical.com> <1521659361.7999.27.camel@perches.com> Message-ID: <152166020495.4865.8856861326837841719@mail.alporthouse.com> User-Agent: alot/0.3.6 Subject: Re: [PATCH] drm/i915/gvt: don't dereference 'workload' before null checking it Date: Wed, 21 Mar 2018 19:23:24 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Colin Ian King (2018-03-21 19:18:28) > On 21/03/18 19:09, Joe Perches wrote: > > On Wed, 2018-03-21 at 19:06 +0000, Colin King wrote: > >> From: Colin Ian King > >> > >> The pointer workload is dereferenced before it is null checked, hence > >> there is a potential for a null pointer dereference on workload. Fix > >> this by only dereferencing workload after it is null checked. > >> > >> Detected by CoverityScan, CID#1466017 ("Dereference before null check") > > > > Maybe true, but is it possible for workload to be null? > > Maybe the null test should be removed instead. > > From what I understand from the static analysis, there may be a > potential for workload to be null, I couldn't rule it out so I went with > the more paranoid stance of keeping the null check in. Not sr_oa_regs() problem if workload is NULL, that's the callers. I reviewed the identical patch yesterday, and we ended up with removing the NULL checks, just keeping the workload->id != RCS. -Chris