Re: [PATCH 01/11] drm/vkms: rename VKMS_LUT_SIZE to VKMS_GAMMA_LUT_SIZE
[email protected] Tue, 04 Aug 2026 20:41:33 +0000
| Newsgroups | org.freedesktop.lists.dri-devel |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: Pre-existing issues: - [High] Incorrect size calculation for gamma_lut validation causes atomic commits to be rejected on 32-bit systems. -- --- Patch [1]: [PATCH 01/11] drm/vkms: rename VKMS_LUT_SIZE to VKMS_GAMMA_LUT_SIZE --- commit 2362b93c64416bccb5039e7ee169799f46cd254c Author: Leandro Ribeiro <[email protected]> drm/vkms: rename VKMS_LUT_SIZE to VKMS_GAMMA_LUT_SIZE This commit renames VKMS_LUT_SIZE to VKMS_GAMMA_LUT_SIZE to clarify that it represents the size of the CRTC gamma LUT. > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c > index 5a640b531d88f..86a8a95694fd7 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.c > +++ b/drivers/gpu/drm/vkms/vkms_drv.c > @@ -113,7 +113,7 @@ static int vkms_atomic_check(struct drm_device *dev, struct drm_atomic_commit *s > continue; > > if (new_crtc_state->gamma_lut->length / sizeof(struct drm_color_lut *) > - > VKMS_LUT_SIZE) > + > VKMS_GAMMA_LUT_SIZE) [Severity: High] This is a pre-existing issue, but does this calculation incorrectly reject atomic commits with valid gamma LUTs on 32-bit systems? Looking at vkms_atomic_check() in drivers/gpu/drm/vkms/vkms_drv.c, it divides the length by the size of a pointer (sizeof(struct drm_color_lut *)) rather than the actual struct size (sizeof(struct drm_color_lut)). On 32-bit architectures, the pointer size is 4 bytes, while the struct itself is 8 bytes. When userspace provides a valid 256-element LUT (2048 bytes), this division calculates the length as 512 elements. This would exceed the VKMS_GAMMA_LUT_SIZE of 256, causing the atomic check to incorrectly fail with -EINVAL. > return -EINVAL; > } > -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1