Received: by 10.213.65.68 with SMTP id h4csp65033imn; Wed, 21 Mar 2018 12:29:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELvR5QexHhXoUbWdwIgzVOzCCY7UXMxbKQYjNYYqxqUxY7AAZ7S6sSpgElVaszuP0+/HtkSr X-Received: by 2002:a17:902:3341:: with SMTP id a59-v6mr5569956plc.68.1521660545010; Wed, 21 Mar 2018 12:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521660544; cv=none; d=google.com; s=arc-20160816; b=U9CNfnNgcoactUULbzl8kdftUzgmtzk9H5XJmrWlQM6RItog4xB5wHFLxnyk/Br69O GiR6nYXsDdbvFdz4oMBjKjReDOwY2Tfbv4kWOZr3HlQa3eAlcXoEj6ENsIdMGOmZDeF2 AfkAuyWYjJmuNFvVflpEXex2/HHbD/7J0TX1euGoGt/H3t23i4+om9Z7dOgNsa5c/y5Q G+IVB57aunNr6qrl9qTtxenNc3Fc7yg9jDE4KIM2zv+w+o6sBTnfOQf9e4bk17jSeNT1 ptlT/VbGtJ4OLWbQz8GLNGK5kT0930AMAepugY3ueP0J/X5jn0+iSdbUa7aQGoeffMx6 MfIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=w6DsIPVhCb5MEdN07cNZdUpiDgrRq2NH8lOwcLux+f0=; b=sVE4/UACKDwHJTx6GGEi5LN8E6IwKNcBOaHq7/YtPvyT+/mKXG/HPi/gQEV8zUCS/G 89wbUDFAQQvlGGpQERa0kVpPGwKt+79RN40qes8hpAaR3ZDYUraQyqQ3e7u3WApLtI9P /3NqT049W4F834ovMbiNwMVWydqZPJat6me4QM8qwQk8rrIXvU0DyXcSMKjVpPkzTgjY kxtqZcuKQmJvbgDacpW+Zzr9mp7oQ6S26vwKXCHCWnJN7yvjfc362r0KvC25Fs1sAPSS KzOvEtRN+YggM4+k7jisQRGt66L+hPltwFYGEbd1OgCmygY7K5PYmf2ZxrKkkTVusB1J R30A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18si3535761pfe.335.2018.03.21.12.28.48; Wed, 21 Mar 2018 12:29:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753494AbeCUTYx (ORCPT + 99 others); Wed, 21 Mar 2018 15:24:53 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54881 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752975AbeCUTYq (ORCPT ); Wed, 21 Mar 2018 15:24:46 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1eyjLl-0002Y6-0k; Wed, 21 Mar 2018 19:24:41 +0000 Subject: Re: [PATCH] drm/i915/gvt: don't dereference 'workload' before null checking it To: Chris Wilson , 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 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> <152166020495.4865.8856861326837841719@mail.alporthouse.com> From: Colin Ian King Message-ID: <1c98c69b-694e-2e1e-ed96-748552c7d6d9@canonical.com> Date: Wed, 21 Mar 2018 19:24:40 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <152166020495.4865.8856861326837841719@mail.alporthouse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/03/18 19:23, Chris Wilson wrote: > 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 > Ah, OK, thanks for the clarification Chris.