Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [PATCH] gpu/drm/xe/xe_devcoredump: Check NULL before dereferencing coredump.
Date: Wed, 20 Mar 2024 10:54:57 +0530	[thread overview]
Message-ID: <98d1434d-c701-4435-873f-023b2df2abce@intel.com> (raw)
In-Reply-To: <85le6d5w27.wl-ashutosh.dixit@intel.com>


On 20-03-2024 10:39, Dixit, Ashutosh wrote:
> On Tue, 19 Mar 2024 22:17:19 -0700, Himal Prasad Ghimiray wrote:
>> Derefernce coredump to get xe_devcoredump_snapshot only if coredump is
>> not NULL.
>>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_devcoredump.c | 11 +++++++----
>>   1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
>> index 0fcd30680323..83a1f3cd37cf 100644
>> --- a/drivers/gpu/drm/xe/xe_devcoredump.c
>> +++ b/drivers/gpu/drm/xe/xe_devcoredump.c
>> @@ -74,17 +74,20 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
>> 				   size_t count, void *data, size_t datalen)
>>   {
>> 	struct xe_devcoredump *coredump = data;
>> +	if (!coredump)
> Needs empty line before this line.
sure.
>
>> +		return -ENODATA;
>> +
>> 	struct xe_device *xe = coredump_to_xe(coredump);
> Declarations after code statements are not premitted in standard C. Does
> this compile?
I was also assuming it will fail but it does pass compilation.
>
> If you fix these things looks like we're back to the original code?
Sorry I didn't understand this. Can you elaborate on this ?
>
>
>> +	/* Our device is gone already... */
>> +	if (!xe)
>> +		return -ENODEV;
>> +
>> 	struct xe_devcoredump_snapshot *ss = &coredump->snapshot;
>> 	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))
>> -		return -ENODEV;
>> -
>> 	/* Ensure delayed work is captured before continuing */
>> 	flush_work(&ss->work);
>>
>> --
>> 2.25.1
>>

  reply	other threads:[~2024-03-20  5:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20  5:17 [PATCH] gpu/drm/xe/xe_devcoredump: Check NULL before dereferencing coredump Himal Prasad Ghimiray
2024-03-20  5:08 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-20  5:09 ` ✓ CI.checkpatch: " Patchwork
2024-03-20  5:09 ` [PATCH] " Dixit, Ashutosh
2024-03-20  5:24   ` Ghimiray, Himal Prasad [this message]
2024-03-21 19:45     ` Rodrigo Vivi
2024-03-20  5:09 ` ✓ CI.KUnit: success for " Patchwork
2024-03-20  5:20 ` ✓ CI.Build: " Patchwork
2024-03-20  5:24 ` ✓ CI.Hooks: " Patchwork
2024-03-20  5:25 ` ✓ CI.checksparse: " Patchwork
2024-03-20  5:46 ` ✓ CI.BAT: " 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=98d1434d-c701-4435-873f-023b2df2abce@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=ashutosh.dixit@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