* [PATCH] drm/xe/guc: Fix deference after check
@ 2024-10-08 20:53 Everest K.C.
2024-10-09 8:00 ` Nirmoy Das
2024-10-11 18:18 ` ✗ CI.Patch_applied: failure for " Patchwork
0 siblings, 2 replies; 3+ messages in thread
From: Everest K.C. @ 2024-10-08 20:53 UTC (permalink / raw)
To: lucas.demarchi, thomas.hellstrom, rodrigo.vivi, maarten.lankhorst,
mripard, tzimmermann, airlied, simona
Cc: Everest K.C., skhan, intel-xe, dri-devel, kernel-janitors,
linux-kernel
The `if (!snapshot->copy)` evaluates to True only when `snapshot->copy`
is Null. Thus, derefrencing `snapshot->copy` inside this if block is
equivalent to Null pointer derefrencing.
The `if` condition is now changed to evaluate to true only when
`snapshot->copy` is not Null.
This issue was reported by Coverity Scan.
Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
---
drivers/gpu/drm/xe/xe_guc_log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c
index 7fbc56cceaba..4e1a5e8ba1e3 100644
--- a/drivers/gpu/drm/xe/xe_guc_log.c
+++ b/drivers/gpu/drm/xe/xe_guc_log.c
@@ -122,7 +122,7 @@ void xe_guc_log_snapshot_free(struct xe_guc_log_snapshot *snapshot)
if (!snapshot)
return;
- if (!snapshot->copy) {
+ if (snapshot->copy) {
for (i = 0; i < snapshot->num_chunks; i++)
kfree(snapshot->copy[i]);
kfree(snapshot->copy);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/xe/guc: Fix deference after check
2024-10-08 20:53 [PATCH] drm/xe/guc: Fix deference after check Everest K.C.
@ 2024-10-09 8:00 ` Nirmoy Das
2024-10-11 18:18 ` ✗ CI.Patch_applied: failure for " Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Nirmoy Das @ 2024-10-09 8:00 UTC (permalink / raw)
To: Everest K.C., lucas.demarchi, thomas.hellstrom, rodrigo.vivi,
maarten.lankhorst, mripard, tzimmermann, airlied, simona
Cc: skhan, intel-xe, dri-devel, kernel-janitors, linux-kernel
On 10/8/2024 10:53 PM, Everest K.C. wrote:
> The `if (!snapshot->copy)` evaluates to True only when `snapshot->copy`
> is Null. Thus, derefrencing `snapshot->copy` inside this if block is
> equivalent to Null pointer derefrencing.
> The `if` condition is now changed to evaluate to true only when
> `snapshot->copy` is not Null.
> This issue was reported by Coverity Scan.
>
> Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
Fixes: d8ce1a977226 ("drm/xe/guc: Use a two stage dump for GuC logs and add more info")
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_log.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c
> index 7fbc56cceaba..4e1a5e8ba1e3 100644
> --- a/drivers/gpu/drm/xe/xe_guc_log.c
> +++ b/drivers/gpu/drm/xe/xe_guc_log.c
> @@ -122,7 +122,7 @@ void xe_guc_log_snapshot_free(struct xe_guc_log_snapshot *snapshot)
> if (!snapshot)
> return;
>
> - if (!snapshot->copy) {
> + if (snapshot->copy) {
> for (i = 0; i < snapshot->num_chunks; i++)
> kfree(snapshot->copy[i]);
> kfree(snapshot->copy);
^ permalink raw reply [flat|nested] 3+ messages in thread* ✗ CI.Patch_applied: failure for drm/xe/guc: Fix deference after check
2024-10-08 20:53 [PATCH] drm/xe/guc: Fix deference after check Everest K.C.
2024-10-09 8:00 ` Nirmoy Das
@ 2024-10-11 18:18 ` Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2024-10-11 18:18 UTC (permalink / raw)
To: Everest K.C.; +Cc: intel-xe
== Series Details ==
Series: drm/xe/guc: Fix deference after check
URL : https://patchwork.freedesktop.org/series/139895/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: d2577be8b969 drm-tip: 2024y-10m-11d-14h-32m-37s UTC integration manifest
=== git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_guc_log.c:122
error: drivers/gpu/drm/xe/xe_guc_log.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/xe/guc: Fix deference after check
Patch failed at 0001 drm/xe/guc: Fix deference after check
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-11 18:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-08 20:53 [PATCH] drm/xe/guc: Fix deference after check Everest K.C.
2024-10-09 8:00 ` Nirmoy Das
2024-10-11 18:18 ` ✗ CI.Patch_applied: failure for " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox