2024-03-07 19:33:16

by Kees Cook

[permalink] [raw]
Subject: Coverity: xe_gt_tlb_invalidation_ggtt(): Error handling issues

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20240307 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

Tue Mar 5 16:48:55 2024 -0800
27ee413bbc0b ("drm/xe: Do not grab forcewakes when issuing GGTT TLB invalidation via GuC")

Coverity reported the following:

*** CID 1584246: Error handling issues (CHECKED_RETURN)
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c:250 in xe_gt_tlb_invalidation_ggtt()
244 seqno = xe_gt_tlb_invalidation_guc(gt);
245 if (seqno <= 0)
246 return seqno;
247
248 xe_gt_tlb_invalidation_wait(gt, seqno);
249 } else if (xe_device_uc_enabled(xe)) {
vvv CID 1584246: Error handling issues (CHECKED_RETURN)
vvv Calling "xe_force_wake_get" without checking return value (as is done elsewhere 15 out of 16 times).
250 xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
251 if (xe->info.platform == XE_PVC || GRAPHICS_VER(xe) >= 20) {
252 xe_mmio_write32(gt, PVC_GUC_TLB_INV_DESC1,
253 PVC_GUC_TLB_INV_DESC1_INVALIDATE);
254 xe_mmio_write32(gt, PVC_GUC_TLB_INV_DESC0,
255 PVC_GUC_TLB_INV_DESC0_VALID);

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <[email protected]>
Addresses-Coverity-ID: 1584246 ("Error handling issues")
Fixes: 27ee413bbc0b ("drm/xe: Do not grab forcewakes when issuing GGTT TLB invalidation via GuC")

Thanks for your attention!

--
Coverity-bot