[PATCH] drm/i915/display: Avoid divide by zero
Ville Syrjälä
ville.syrjala at linux.intel.com
Thu Aug 21 13:05:07 UTC 2025
On Wed, Aug 20, 2025 at 04:29:13PM +0300, Juha-Pekka Heikkila wrote:
> skl_crtc_allocate_plane_ddb allow iter.data_rate to be zero
> which could cause divide by zero in skl_allocate_plane_ddb,
> check against that.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
> drivers/gpu/drm/i915/display/skl_watermark.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
> index def5150231a4..403783504ab3 100644
> --- a/drivers/gpu/drm/i915/display/skl_watermark.c
> +++ b/drivers/gpu/drm/i915/display/skl_watermark.c
> @@ -1388,7 +1388,7 @@ skl_allocate_plane_ddb(struct skl_plane_ddb_iter *iter,
> {
> u16 size, extra = 0;
>
> - if (data_rate) {
> + if (data_rate && iter->data_rate) {
I don't think it should be possible to have iter_data->data_rate==0
and data_rate!=0, with iter->data_rate being the sum of all the
planes' data_rates.
> extra = min_t(u16, iter->size,
> DIV64_U64_ROUND_UP(iter->size * data_rate,
> iter->data_rate));
> --
> 2.43.0
--
Ville Syrjälä
Intel
More information about the Intel-xe
mailing list