Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The set_error_threshold callback implementation does not perform bounds checking on the threshold value. --
commit fed54e8b69e86b28d2dcdaf8a7fe08701b357d95 Author: Raag Jadav <[email protected]> drm/xe/drm_ras: Wire up error threshold callbacks This commit wires up the get and set error threshold callbacks to the drm_ras infrastructure, allowing userspace to configure these thresholds via netlink commands. > diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c > index 7937d8ba0ed9c..4afa2ad98300f 100644 > --- a/drivers/gpu/drm/xe/xe_drm_ras.c > +++ b/drivers/gpu/drm/xe/xe_drm_ras.c [ ... ] > @@ -86,6 +86,38 @@ static int clear_correctable_error_counter(struct > drm_ras_node *node, u32 error_ [ ... ] > +static int set_correctable_error_threshold(struct drm_ras_node *ep, u32 > error_id, u32 threshold) > +{ > + struct xe_device *xe = ep->priv; > + struct xe_drm_ras *ras = &xe->ras; > + struct xe_drm_ras_counter *info = > ras->info[DRM_XE_RAS_ERR_SEV_CORRECTABLE]; > + > + if (!info || !info[error_id].name) > + return -ENOENT; > + > + if (!xe->info.has_sysctrl) > + return -EOPNOTSUPP; > + [Severity: Medium] Does this code need bounds checking for the threshold value before passing it to the hardware? The drm_ras API documentation for set_error_threshold specifies that the driver is responsible for error threshold bounds checking. If a privileged user provides an extreme value, such as 0, could this result in undefined hardware behavior or continuous interrupts from the system controller? > + return xe_ras_set_threshold(xe, DRM_XE_RAS_ERR_SEV_CORRECTABLE, > error_id, threshold); > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=4
