mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
drm/xe/xe_survivability: Add index bound check
Fix static analysis tool reported issue. Add index bound check before
accessing info array to prevent out of bound.
Fixes: f4e9fc967a ("drm/xe/xe_survivability: Redesign survivability mode")
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patch.msgid.link/20251219105224.871930-6-riana.tauro@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
3d50c69c58
commit
13fe9fa7f4
|
|
@ -251,10 +251,14 @@ static umode_t survivability_info_attrs_visible(struct kobject *kobj, struct att
|
|||
struct xe_survivability *survivability = &xe->survivability;
|
||||
u32 *info = survivability->info;
|
||||
|
||||
/* FDO mode is visible only when supported */
|
||||
if (idx >= MAX_SCRATCH_REG && survivability->version >= 2)
|
||||
/*
|
||||
* Last index in survivability_info_attrs is fdo mode and is applicable only in
|
||||
* version 2 of survivability mode
|
||||
*/
|
||||
if (idx == MAX_SCRATCH_REG && survivability->version >= 2)
|
||||
return 0400;
|
||||
else if (info[idx])
|
||||
|
||||
if (idx < MAX_SCRATCH_REG && info[idx])
|
||||
return 0400;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user