mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 11:33:36 -04:00
drm/atomic: add max_size check to drm_property_replace_blob_from_id()
The function drm_property_replace_blob_from_id() allows checking whether the blob size is equal to a predefined value. In case of variable-size properties (like the gamma / degamma LUTs) we might want to check for the blob size against the maximum, allowing properties of the size lesser than the max supported by the hardware. Extend the function in order to support such checks. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/20260106-drm-fix-lut-checks-v3-2-f7f979eb73c8@oss.qualcomm.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
This commit is contained in:
@@ -416,7 +416,7 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
|
||||
ret = drm_property_replace_blob_from_id(dev,
|
||||
&state->degamma_lut,
|
||||
val,
|
||||
-1, sizeof(struct drm_color_lut),
|
||||
-1, -1, sizeof(struct drm_color_lut),
|
||||
&replaced);
|
||||
state->color_mgmt_changed |= replaced;
|
||||
return ret;
|
||||
@@ -424,7 +424,7 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
|
||||
ret = drm_property_replace_blob_from_id(dev,
|
||||
&state->ctm,
|
||||
val,
|
||||
sizeof(struct drm_color_ctm), -1,
|
||||
-1, sizeof(struct drm_color_ctm), -1,
|
||||
&replaced);
|
||||
state->color_mgmt_changed |= replaced;
|
||||
return ret;
|
||||
@@ -432,7 +432,7 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
|
||||
ret = drm_property_replace_blob_from_id(dev,
|
||||
&state->gamma_lut,
|
||||
val,
|
||||
-1, sizeof(struct drm_color_lut),
|
||||
-1, -1, sizeof(struct drm_color_lut),
|
||||
&replaced);
|
||||
state->color_mgmt_changed |= replaced;
|
||||
return ret;
|
||||
@@ -587,8 +587,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
|
||||
ret = drm_property_replace_blob_from_id(dev,
|
||||
&state->fb_damage_clips,
|
||||
val,
|
||||
-1,
|
||||
sizeof(struct drm_mode_rect),
|
||||
-1, -1, sizeof(struct drm_mode_rect),
|
||||
&replaced);
|
||||
return ret;
|
||||
} else if (property == plane->scaling_filter_property) {
|
||||
@@ -717,8 +716,7 @@ static int drm_atomic_color_set_data_property(struct drm_colorop *colorop,
|
||||
return drm_property_replace_blob_from_id(colorop->dev,
|
||||
&state->data,
|
||||
val,
|
||||
size,
|
||||
elem_size,
|
||||
-1, size, elem_size,
|
||||
&replaced);
|
||||
}
|
||||
|
||||
@@ -876,7 +874,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
|
||||
ret = drm_property_replace_blob_from_id(dev,
|
||||
&state->hdr_output_metadata,
|
||||
val,
|
||||
sizeof(struct hdr_output_metadata), -1,
|
||||
-1, sizeof(struct hdr_output_metadata), -1,
|
||||
&replaced);
|
||||
return ret;
|
||||
} else if (property == config->aspect_ratio_property) {
|
||||
|
||||
Reference in New Issue
Block a user