Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Validation check for a 64-bit bitmask on 32-bit platforms 
incorrectly uses the 32-bit `BIT()` macro, causing upper bits to be silently 
ignored.
--

--- Patch [1]: [PATCH v4 01/11] drm/colorop: Add DRM_COLOROP_FIXED_MATRIX ---
commit e2a1cc91ee8bca2062d87fc6c62ee5b47046aaf8
Author: Chaitanya Kumar Borah <[email protected]>
Subject: drm/colorop: Add DRM_COLOROP_FIXED_MATRIX

This commit introduces DRM_COLOROP_FIXED_MATRIX, a new colorop type
representing hardware that performs a fixed matrix operation. It adds a new
FIXED_MATRIX_TYPE enum property to select predefined hardware modes instead
of using programmable coefficients.

> diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
> index 682fcc6515259..e7ccf7d053b89 100644
> --- a/drivers/gpu/drm/drm_colorop.c
> +++ b/drivers/gpu/drm/drm_colorop.c
[ ... ]
> +int drm_plane_colorop_fixed_matrix_init(struct drm_device *dev, struct 
> drm_colorop *colorop,
> +                                     struct drm_plane *plane,
> +                                     const struct drm_colorop_funcs *funcs,
> +                                     u64 supported_fm, uint32_t flags)
> +{
[ ... ]
> +     if (!supported_fm) {
> +             drm_err(dev,
> +                     "No supported FM type op for new Fixed Matrix colorop 
> on [PLANE:%d:%s]\n",
> +                     plane->base.id, plane->name);
> +             return -EINVAL;
> +     }
> +
> +     if ((supported_fm & -BIT(DRM_COLOROP_FM_COUNT)) != 0) {

[Severity: Medium]
Since supported_fm is a u64, will this check properly mask the upper 32 bits on
32-bit platforms where BIT() evaluates to a 32-bit unsigned long?

When -BIT(DRM_COLOROP_FM_COUNT) is promoted to 64 bits for the bitwise AND, it
will be zero-extended, causing the upper 32 bits of the mask to be zero. This
could allow invalid upper bits in supported_fm to pass validation silently.

Should this use BIT_ULL() instead?

> +             drm_err(dev, "Unknown Fixed Matrix provided on [PLANE:%d:%s]\n",
> +                     plane->base.id, plane->name);
> +             return -EINVAL;
> +     }

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to