From: Lucas De Marchi lucas.demarchi@intel.com
[ Upstream commit 75584c8213d341ddd5b7c72abf822e62f4b3ab27 ]
The `entries` variable is used to loop through the array - it's supposed to be const, but not static.
Reviewed-by: John Harrison John.C.Harrison@Intel.com Link: https://patchwork.freedesktop.org/patch/msgid/20250307-xe-per-gt-fw-v1-1-459... Signed-off-by: Lucas De Marchi lucas.demarchi@intel.com Signed-off-by: Sasha Levin sashal@kernel.org ---
**YES** This commit should be backported to stable kernel trees. Here's my extensive analysis: ## Commit Analysis **Type of Issue:** This commit fixes an incorrect use of the `static` storage class specifier on a local variable that should be a simple `const` pointer. **Code Analysis:** - The problematic line changes `static const struct uc_fw_entry *entries;` to `const struct uc_fw_entry *entries;` - This variable is used as a loop iteration pointer in the `uc_fw_auto_select()` function - The variable gets assigned from `blobs_all[uc_fw->type].entries` and is used to iterate through firmware entries - The `static` keyword is incorrect here because this should be a local variable that gets reinitialized on each function call **Impact Assessment:** - **Bug severity:** This is a subtle but real bug that affects driver correctness - **User impact:** Could cause firmware selection issues in Intel Xe GPU drivers, potentially leading to graphics driver failures or incorrect firmware loading - **Risk:** The incorrect `static` storage could cause the `entries` pointer to retain stale values across function calls, leading to unpredictable firmware selection behavior **Backport Suitability Criteria:** 1. ✅ **Fixes a real bug:** Yes, incorrect storage class affects program correctness 2. ✅ **Small and contained:** Single line change, minimal risk 3. ✅ **No side effects:** Pure bug fix with no behavioral changes beyond correcting the error 4. ✅ **No architectural changes:** Simple variable declaration fix 5. ✅ **Minimal regression risk:** Extremely low risk - makes the code work as originally intended 6. ✅ **Follows stable tree rules:** Important bugfix, minimal risk, contained change **Historical Precedent:** This commit is nearly identical to the i915 commit `5821a0bbb4c3` which was backported (marked as "YES" in the reference commits). Both commits: - Fix the exact same type of bug (accidental `static` on local variable) - Affect similar firmware selection code in Intel GPU drivers - Have identical risk profiles and change patterns - Were authored by the same team working on Intel GPU microcontroller firmware **Conclusion:** This is a clear candidate for backporting - it fixes a genuine bug that could affect system stability, has minimal risk of regression, and follows the established pattern of similar fixes that have been successfully backported.
drivers/gpu/drm/xe/xe_uc_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_uc_fw.c b/drivers/gpu/drm/xe/xe_uc_fw.c index fb0eda3d56829..b553079ae3d64 100644 --- a/drivers/gpu/drm/xe/xe_uc_fw.c +++ b/drivers/gpu/drm/xe/xe_uc_fw.c @@ -222,8 +222,8 @@ uc_fw_auto_select(struct xe_device *xe, struct xe_uc_fw *uc_fw) [XE_UC_FW_TYPE_HUC] = { entries_huc, ARRAY_SIZE(entries_huc) }, [XE_UC_FW_TYPE_GSC] = { entries_gsc, ARRAY_SIZE(entries_gsc) }, }; - static const struct uc_fw_entry *entries; enum xe_platform p = xe->info.platform; + const struct uc_fw_entry *entries; u32 count; int i;