Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Ashutosh Dixit <ashutosh.dixit@intel.com>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: Re: [PATCH] drm/xe/oa: Fix potential NPD when OA is not initialized
Date: Wed, 19 Jun 2024 14:40:38 -0400	[thread overview]
Message-ID: <ZnMmJuEcOyYARokB@intel.com> (raw)
In-Reply-To: <20240619175427.861-1-michal.wajdeczko@intel.com>

On Wed, Jun 19, 2024 at 07:54:27PM +0200, Michal Wajdeczko wrote:
> If oa->xe can be NULL then we shall not use it as a valid pointer.
> 

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> 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 <michal.wajdeczko@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> ---
>  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 = &param;
>  	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
> 

  parent reply	other threads:[~2024-06-19 18:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 17:54 [PATCH] drm/xe/oa: Fix potential NPD when OA is not initialized Michal Wajdeczko
2024-06-19 18:11 ` ✓ CI.Patch_applied: success for " Patchwork
2024-06-19 18:11 ` ✓ CI.checkpatch: " Patchwork
2024-06-19 18:12 ` ✓ CI.KUnit: " Patchwork
2024-06-19 18:24 ` ✓ CI.Build: " Patchwork
2024-06-19 18:26 ` ✗ CI.Hooks: failure " Patchwork
2024-06-19 18:27 ` ✓ CI.checksparse: success " Patchwork
2024-06-19 18:40 ` Rodrigo Vivi [this message]
2024-06-19 20:59 ` [PATCH] " Dixit, Ashutosh
2024-06-20 16:16   ` Dixit, Ashutosh
2024-06-20  1:02 ` ✗ CI.FULL: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZnMmJuEcOyYARokB@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.wajdeczko@intel.com \
    --cc=umesh.nerlige.ramappa@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox