Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Souza, Jose" <jose.souza@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
Cc: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>,
	"Vivi, Rodrigo" <rodrigo.vivi@intel.com>
Subject: Re: [PATCH v4] drm/xe/xe_devcoredump: Check NULL before dereferencing
Date: Fri, 22 Mar 2024 17:13:59 +0000	[thread overview]
Message-ID: <414f736aecac2231ec61e19c9e3f2e3099aa712a.camel@intel.com> (raw)
In-Reply-To: <20240322172447.3372167-1-himal.prasad.ghimiray@intel.com>

On Fri, 2024-03-22 at 22:54 +0530, Himal Prasad Ghimiray wrote:
> Dereference 'coredump' to access 'xe_devcoredump_snapshot' only if
> 'coredump' is not NULL,
> 
> v2
> - Fix commit messages.
> 
> v3
> - Define variables before code.(Ashutosh/Jose)
> 
> v4
> - Drop return check for coredump_to_xe. (Jose/Rodrigo)
> 
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_devcoredump.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
> index 3a6263ecff01..a951043b2943 100644
> --- a/drivers/gpu/drm/xe/xe_devcoredump.c
> +++ b/drivers/gpu/drm/xe/xe_devcoredump.c
> @@ -77,17 +77,19 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
>  				   size_t count, void *data, size_t datalen)
>  {
>  	struct xe_devcoredump *coredump = data;
> -	struct xe_device *xe = coredump_to_xe(coredump);
> -	struct xe_devcoredump_snapshot *ss = &coredump->snapshot;
> +	struct xe_device *xe;
> +	struct xe_devcoredump_snapshot *ss;
>  	struct drm_printer p;
>  	struct drm_print_iterator iter;
>  	struct timespec64 ts;
>  	int i;
>  
> -	/* Our device is gone already... */
> -	if (!data || !coredump_to_xe(coredump))
> +	if (!coredump)
>  		return -ENODEV;
>  
> +	xe = coredump_to_xe(coredump);
> +	ss = &coredump->snapshot;
> +
>  	/* Ensure delayed work is captured before continuing */
>  	flush_work(&ss->work);
>  


  reply	other threads:[~2024-03-22 17:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 17:24 [PATCH v4] drm/xe/xe_devcoredump: Check NULL before dereferencing Himal Prasad Ghimiray
2024-03-22 17:13 ` Souza, Jose [this message]
2024-03-22 17:18 ` ✓ CI.Patch_applied: success for drm/xe/xe_devcoredump: Check NULL before dereferencing (rev3) Patchwork
2024-03-22 17:18 ` ✓ CI.checkpatch: " Patchwork
2024-03-22 17:19 ` ✓ CI.KUnit: " Patchwork
2024-03-22 17:30 ` ✓ CI.Build: " Patchwork
2024-03-22 17:32 ` ✓ CI.Hooks: " Patchwork
2024-03-22 17:34 ` ✓ CI.checksparse: " Patchwork
2024-03-22 18:00 ` ✓ CI.BAT: " Patchwork
2024-03-25 17:08 ` [PATCH v4] drm/xe/xe_devcoredump: Check NULL before dereferencing Matt Roper
2024-03-28 12:11   ` Ghimiray, Himal Prasad

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=414f736aecac2231ec61e19c9e3f2e3099aa712a.camel@intel.com \
    --to=jose.souza@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=rodrigo.vivi@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