From: sashiko-bot@kernel.org
To: "Shirong Zhao" <shxzhaosr@163.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/msm/dpu: avoid division by zero in plane bandwidth calc
Date: Sun, 06 Dec 2026 04:43:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-252145@kernel.org> (raw)
In-Reply-To: <20261206042720.42-1-shxzhaosr@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/msm/dpu: fallback division by zero in
_dpu_plane_calc_bw() on SC8280XP
--
commit 6a9f48e9576cc98f921a8bdedc159b2c2b15f863
Author: Shirong Zhao <shxzhaosr@163.com>
drm/msm/dpu: avoid division by zero in plane bandwidth calc
This commit adds a non-zero check on (vbp+vpw+vfp) in
_dpu_plane_calc_bw() so that modes with zero vertical blanking fall back
to dividing by hw_latency_lines.
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> index 1a471cdf767b1..7a8032eced27b 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> @@ -146,7 +146,7 @@ static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog,
>
> if ((vbp+vpw) > hw_latency_lines)
> do_div(plane_prefill_bw, (vbp+vpw));
> - else if ((vbp+vpw+vfp) < hw_latency_lines)
> + else if ((vbp+vpw+vfp) && (vbp+vpw+vfp) < hw_latency_lines)
> do_div(plane_prefill_bw, (vbp+vpw+vfp));
> else
> do_div(plane_prefill_bw, hw_latency_lines);
[Severity: Medium]
Can the else branch still divide by zero on sc8280xp when hw_latency_lines
is 0?
hw_latency_lines comes from catalog->perf->min_prefill_lines, which
sc8280xp_perf_data in
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_8_0_sc8280xp.h leaves unset (0).
On qcom,sc8280xp-dpu, a mode with zero vertical blanking reaches the else
branch and calls do_div(plane_prefill_bw, 0), causing a divide-by-zero
splat under UBSAN (or a panic with CONFIG_UBSAN_TRAP).
Since plane_prefill_bw is just plane_bw * hw_latency_lines, setting
plane_prefill_bw = plane_bw in the else branch avoids dividing by zero on
all platforms; sc8280xp_perf_data should also set .min_prefill_lines.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206042720.42-1-shxzhaosr@163.com?part=1
next prev parent reply other threads:[~2026-12-06 4:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 4:27 [PATCH] drm/msm/dpu: avoid division by zero in plane bandwidth calc Shirong Zhao
2026-12-06 4:43 ` sashiko-bot [this message]
2026-12-06 4:57 ` [PATCH v2] " Shirong Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-252145@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shxzhaosr@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.