mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
drm/vc4: Validate the size of the gamma_lut
Add a check to vc4_hvs_gamma_check to ensure a new non-empty gamma LUT is of the correct length before accepting it. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
6954044a8b
commit
91eab75a15
@@ -614,6 +614,16 @@ static int vc4_hvs_gamma_check(struct drm_crtc *crtc,
|
||||
if (!crtc_state->color_mgmt_changed)
|
||||
return 0;
|
||||
|
||||
if (crtc_state->gamma_lut) {
|
||||
unsigned int len = drm_color_lut_size(crtc_state->gamma_lut);
|
||||
|
||||
if (len != crtc->gamma_size) {
|
||||
DRM_DEBUG_KMS("Invalid LUT size; got %u, expected %u\n",
|
||||
len, crtc->gamma_size);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
connector = vc4_get_crtc_connector(crtc, crtc_state);
|
||||
if (!connector)
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user