From: Zhanjun Dong <zhanjun.dong@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Zhanjun Dong <zhanjun.dong@intel.com>
Subject: [PATCH 1/7] drm/xe: Add null pointer check for xe_migrate_copy
Date: Tue, 17 Sep 2024 10:43:18 -0700 [thread overview]
Message-ID: <20240917174324.967870-2-zhanjun.dong@intel.com> (raw)
In-Reply-To: <20240917174324.967870-1-zhanjun.dong@intel.com>
Add null pointer check for parameter src.
Signed-off-by: Zhanjun Dong <zhanjun.dong@intel.com>
---
drivers/gpu/drm/xe/xe_migrate.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
index cfd31ae49cc1..45bba0d731ec 100644
--- a/drivers/gpu/drm/xe/xe_migrate.c
+++ b/drivers/gpu/drm/xe/xe_migrate.c
@@ -774,14 +774,22 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
u64 src_L0, dst_L0;
int pass = 0;
int err;
- bool src_is_pltt = src->mem_type == XE_PL_TT;
- bool dst_is_pltt = dst->mem_type == XE_PL_TT;
- bool src_is_vram = mem_type_is_vram(src->mem_type);
- bool dst_is_vram = mem_type_is_vram(dst->mem_type);
- bool copy_ccs = xe_device_has_flat_ccs(xe) &&
- xe_bo_needs_ccs_pages(src_bo) && xe_bo_needs_ccs_pages(dst_bo);
- bool copy_system_ccs = copy_ccs && (!src_is_vram || !dst_is_vram);
- bool use_comp_pat = xe_device_has_flat_ccs(xe) &&
+ bool src_is_pltt, dst_is_pltt;
+ bool src_is_vram, dst_is_vram;
+ bool copy_ccs, copy_system_ccs;
+ bool use_comp_pat;
+
+ if (!src)
+ return ERR_PTR(-EINVAL);
+
+ src_is_pltt = src->mem_type == XE_PL_TT;
+ dst_is_pltt = dst->mem_type == XE_PL_TT;
+ src_is_vram = mem_type_is_vram(src->mem_type);
+ dst_is_vram = mem_type_is_vram(dst->mem_type);
+ copy_ccs = xe_device_has_flat_ccs(xe) && xe_bo_needs_ccs_pages(src_bo) &&
+ xe_bo_needs_ccs_pages(dst_bo);
+ copy_system_ccs = copy_ccs && (!src_is_vram || !dst_is_vram);
+ use_comp_pat = xe_device_has_flat_ccs(xe) &&
GRAPHICS_VER(xe) >= 20 && src_is_vram && !dst_is_vram;
/* Copying CCS between two different BOs is not supported yet. */
--
2.34.1
next prev parent reply other threads:[~2024-09-17 17:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 17:43 [PATCH 0/7] FOR-CI: test null pointer fix Zhanjun Dong
2024-09-17 17:43 ` Zhanjun Dong [this message]
2024-09-17 17:43 ` [PATCH 2/7] drm/xe/guc: Prepare GuC register list and update ADS size for error capture Zhanjun Dong
2024-09-17 17:43 ` [PATCH 3/7] drm/xe/guc: Add XE_LP steered register lists Zhanjun Dong
2024-09-17 17:43 ` [PATCH 4/7] drm/xe/guc: Add capture size check in GuC log buffer Zhanjun Dong
2024-09-17 17:43 ` [PATCH 5/7] drm/xe/guc: Extract GuC error capture lists Zhanjun Dong
2024-09-17 17:43 ` [PATCH 6/7] drm/xe/guc: Plumb GuC-capture into dev coredump Zhanjun Dong
2024-09-17 17:43 ` [PATCH 7/7] drm/xe/guc: Save manual engine capture into capture list Zhanjun Dong
2024-09-17 18:38 ` ✓ CI.Patch_applied: success for FOR-CI: test null pointer fix Patchwork
2024-09-17 18:38 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-17 18:40 ` ✓ CI.KUnit: success " Patchwork
2024-09-17 18:51 ` ✓ CI.Build: " Patchwork
2024-09-17 18:54 ` ✓ CI.Hooks: " Patchwork
2024-09-17 18:55 ` ✓ CI.checksparse: " Patchwork
2024-09-17 19:20 ` ✗ CI.BAT: failure " Patchwork
2024-09-17 20:45 ` ✓ CI.FULL: success " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-09-18 16:40 [PATCH 0/7] " Zhanjun Dong
2024-09-18 16:40 ` [PATCH 1/7] drm/xe: Add null pointer check for xe_migrate_copy Zhanjun Dong
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=20240917174324.967870-2-zhanjun.dong@intel.com \
--to=zhanjun.dong@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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