Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues: - [High] This problem wasn't introduced by this patch, but if colorop initialization fails early, the cleanup path calls `intel_colorop_destroy()` on a partially initialized object, leading to a NULL pointer dereference and uninitialized list head usage. - [High] This problem wasn't introduced by this patch, but an unchecked return value from `kasprintf()` leads to a NULL pointer dereference when creating the color pipeline property. -- --- Patch [9]: [v5 09/14] drm/i915/color: Add support for 1D LUT in SDR planes --- commit e6938001b7cb4179a20fa4b4c3bd94fef8282c50 Author: Chaitanya Kumar Borah <[email protected]> drm/i915/color: Add support for 1D LUT in SDR planes Extend the SDR plane color pipeline to include pre- and post-CSC 1D LUT blocks. SDR planes use a smaller LUT size than HDR planes and therefore initialize the 1D LUT colorops with the appropriate hardware capacity. > diff --git a/drivers/gpu/drm/i915/display/intel_color_pipeline.c > b/drivers/gpu/drm/i915/display/intel_color_pipeline.c > index 7457fa51cb97a..136b9378ca484 100644 > --- a/drivers/gpu/drm/i915/display/intel_color_pipeline.c > +++ b/drivers/gpu/drm/i915/display/intel_color_pipeline.c [ ... ] > @@ -81,7 +86,9 @@ struct intel_colorop > *intel_color_pipeline_plane_add_colorop(struct drm_plane *p > ret = drm_plane_colorop_curve_1d_lut_init(dev, > &colorop->base, plane, > &intel_colorop_funcs, > - PLANE_DEGAMMA_SIZE, > + is_hdr ? > + PLANE_DEGAMMA_SIZE : > + > PLANE_DEGAMMA_SIZE_SDR, > > DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR, > > DRM_COLOROP_FLAG_ALLOW_BYPASS); > break; [Severity: High] This isn't a bug introduced by this patch, but if colorop initialization fails early, the cleanup path calls intel_colorop_destroy() on a partially initialized object. Could this lead to a NULL pointer dereference and uninitialized list head usage? If drm_plane_colorop_init() fails early (e.g., drm_mode_object_add() returns -ENOMEM), colorop->dev remains NULL and colorop->head is zero-filled. The error path jumps to cleanup and invokes intel_colorop_destroy(), which delegates to drm_colorop_cleanup(): drivers/gpu/drm/drm_colorop.c:drm_colorop_cleanup() { struct drm_mode_config *config = &dev->mode_config; list_del(&colorop->head); config->num_colorop--; } This unconditionally dereferences dev (which is NULL) and calls list_del() on a zero-filled list head. [Severity: High] This is also a pre-existing issue in the same file, but an unchecked return value from kasprintf() can lead to a NULL pointer dereference when creating the color pipeline property. In _intel_color_pipeline_plane_init(), kasprintf() allocates memory for list->name: drivers/gpu/drm/i915/display/intel_color_pipeline.c:_intel_color_pipeline_plane_init() { ... list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", colorop[0]->base.base.id); return 0; } If kasprintf() fails, it returns NULL, and the function unconditionally returns success. This NULL name is later passed to drm_property_add_enum(), where a strlen(name) call will crash the kernel: drivers/gpu/drm/drm_property.c:drm_property_add_enum() { ... if (WARN_ON(strlen(name) >= DRM_PROP_NAME_LEN)) return 0; ... } Should the return value of kasprintf() be checked and handled as an error here? -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=9
