From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F11BAC27C53 for ; Wed, 19 Jun 2024 21:07:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 97A5010E010; Wed, 19 Jun 2024 21:07:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="SOMxiCDX"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id C7E7510E010 for ; Wed, 19 Jun 2024 21:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718831273; x=1750367273; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=3t9Xhj81ri48vhr5IjfsaFQrITSjVfhf9+a05UDfFeM=; b=SOMxiCDXhUcvihuMDemO/dwWr6P9Tm9snmjuneOwAz7I0+WA9Qoqom6F 713NuNEQeW2Bzx05yAZmm77A/7Its/446zYsljAynUCO+RO+yPLca/5rr mD78QpRdr/UD+XzUfXgQiYlFJVd5CSgdPphX8YehZ06DWbzKkqI+t027E gayxugzpSS5BMTvGTfc+q9aTXfzuiwx8tIQ6souuiuwN8Z3qzJVET4RNt a6QDNgQdq2TVOFvDoGq9NtN3kZ/27PL+W/gj0IO+rMUplLwP6THbe4AWW 6QtRRxG/E8TDnBG6xrj/hKa4EoBo5MgCkHCUDVrUreO/TiVh+jgiBfl8O g==; X-CSE-ConnectionGUID: Jw6F10P5RfO0vzHSpG3OIg== X-CSE-MsgGUID: VL15gvArRbi2Cokpp6vulg== X-IronPort-AV: E=McAfee;i="6700,10204,11108"; a="26474150" X-IronPort-AV: E=Sophos;i="6.08,251,1712646000"; d="scan'208";a="26474150" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2024 14:07:52 -0700 X-CSE-ConnectionGUID: 40xMQi05Qm+oYaba6dK/zw== X-CSE-MsgGUID: 2jTI4O4qR2y5gNKN94rmow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,251,1712646000"; d="scan'208";a="73225423" Received: from vishrutm-mobl11.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.125.97.201]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2024 14:07:52 -0700 Date: Wed, 19 Jun 2024 13:59:18 -0700 Message-ID: <878qz0zm1l.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Michal Wajdeczko Cc: , Rodrigo Vivi , "Umesh\ Nerlige Ramappa" Subject: Re: [PATCH] drm/xe/oa: Fix potential NPD when OA is not initialized In-Reply-To: <20240619175427.861-1-michal.wajdeczko@intel.com> References: <20240619175427.861-1-michal.wajdeczko@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.3 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Wed, 19 Jun 2024 10:54:27 -0700, Michal Wajdeczko wrote: > > If oa->xe can be NULL then we shall not use it as a valid pointer. Hi Michal, thanks for catching this: Reviewed-by: Ashutosh Dixit > Fixes: cdf02fe1a94a ("drm/xe/oa/uapi: Add/remove OA config perf ops") > Fixes: b6fd51c62119 ("drm/xe/oa/uapi: Define and parse OA stream properties") > Signed-off-by: Michal Wajdeczko > Cc: Rodrigo Vivi > Cc: Ashutosh Dixit > Cc: Umesh Nerlige Ramappa > --- > drivers/gpu/drm/xe/xe_oa.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c > index 34206e0b6a08..2277af816a34 100644 > --- a/drivers/gpu/drm/xe/xe_oa.c > +++ b/drivers/gpu/drm/xe/xe_oa.c > @@ -1725,7 +1725,8 @@ static int xe_oa_user_extensions(struct xe_oa *oa, u64 extension, int ext_number > */ > int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *file) > { > - struct xe_oa *oa = &to_xe_device(dev)->oa; > + struct xe_device *xe = to_xe_device(dev); > + struct xe_oa *oa = &xe->oa; > struct xe_file *xef = to_xe_file(file); > struct xe_oa_open_param param = {}; > const struct xe_oa_format *f; > @@ -1733,7 +1734,7 @@ int xe_oa_stream_open_ioctl(struct drm_device *dev, u64 data, struct drm_file *f > int ret; > > if (!oa->xe) { > - drm_dbg(&oa->xe->drm, "xe oa interface not available for this system\n"); > + drm_dbg(&xe->drm, "xe oa interface not available for this system\n"); > return -ENODEV; > } > > @@ -2005,7 +2006,8 @@ static int create_dynamic_oa_sysfs_entry(struct xe_oa *oa, > */ > int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *file) > { > - struct xe_oa *oa = &to_xe_device(dev)->oa; > + struct xe_device *xe = to_xe_device(dev); > + struct xe_oa *oa = &xe->oa; > struct drm_xe_oa_config param; > struct drm_xe_oa_config *arg = ¶m; > struct xe_oa_config *oa_config, *tmp; > @@ -2013,7 +2015,7 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fi > int err, id; > > if (!oa->xe) { > - drm_dbg(&oa->xe->drm, "xe oa interface not available for this system\n"); > + drm_dbg(&xe->drm, "xe oa interface not available for this system\n"); > return -ENODEV; > } > > @@ -2106,13 +2108,14 @@ int xe_oa_add_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *fi > */ > int xe_oa_remove_config_ioctl(struct drm_device *dev, u64 data, struct drm_file *file) > { > - struct xe_oa *oa = &to_xe_device(dev)->oa; > + struct xe_device *xe = to_xe_device(dev); > + struct xe_oa *oa = &xe->oa; > struct xe_oa_config *oa_config; > u64 arg, *ptr = u64_to_user_ptr(data); > int ret; > > if (!oa->xe) { > - drm_dbg(&oa->xe->drm, "xe oa interface not available for this system\n"); > + drm_dbg(&xe->drm, "xe oa interface not available for this system\n"); > return -ENODEV; > } > > -- > 2.43.0 >