From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
Cc: robdclark@gmail.com, quic_abhinavk@quicinc.com,
linux-arm-msm@vger.kernel.org, sean@poorly.run,
marijn.suijten@somainline.org, airlied@gmail.com,
simona@ffwll.ch, quic_bjorande@quicinc.com,
quic_parellan@quicinc.com, quic_khsieh@quicinc.com,
dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
dianders@chromium.org
Subject: Re: [PATCH drm-next] drm/msm/dp: Fix potential division by zero issue
Date: Wed, 20 Nov 2024 13:02:32 +0200 [thread overview]
Message-ID: <piembwzz7x6plsps3umjg3b3pi2ii44svmeii3wwtydtriceny@uqq7ck2ge5zz> (raw)
In-Reply-To: <20241120050451.100957-1-dheeraj.linuxdev@gmail.com>
On Wed, Nov 20, 2024 at 10:34:51AM +0530, Dheeraj Reddy Jonnalagadda wrote:
> The variable pixel_div can remain zero due to an invalid rate input,
No, it can not. Rate is set by the driver, which knowns which rates are
supported.
> leading to a potential division by zero issue. This patch fixes it and
> the function now logs an error and returns early.
See Documentation/process/submitting-patches.rst, look for "This patch"
string.
>
> Additionally, this patch resolves trailing whitespace issues detected
> by checkpatch.pl in the same file.
Additionally perform ... => separate commits.
>
> Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
> ---
> drivers/gpu/drm/msm/dp/dp_catalog.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c
> index b4c8856fb25d..e170f70f1d42 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
> @@ -225,7 +225,7 @@ int msm_dp_catalog_aux_clear_hw_interrupts(struct msm_dp_catalog *msm_dp_catalog
> * This function reset AUX controller
> *
> * NOTE: reset AUX controller will also clear any pending HPD related interrupts
> - *
> + *
> */
> void msm_dp_catalog_aux_reset(struct msm_dp_catalog *msm_dp_catalog)
> {
> @@ -487,8 +487,10 @@ void msm_dp_catalog_ctrl_config_msa(struct msm_dp_catalog *msm_dp_catalog,
> pixel_div = 2;
> else if (rate == link_rate_hbr2)
> pixel_div = 4;
> - else
> + else {
> DRM_ERROR("Invalid pixel mux divider\n");
> + return;
> + }
>
> dispcc_input_rate = (rate * 10) / pixel_div;
>
> @@ -579,7 +581,7 @@ u32 msm_dp_catalog_hw_revision(const struct msm_dp_catalog *msm_dp_catalog)
> * This function reset the DP controller
> *
> * NOTE: reset DP controller will also clear any pending HPD related interrupts
> - *
> + *
> */
> void msm_dp_catalog_ctrl_reset(struct msm_dp_catalog *msm_dp_catalog)
> {
> --
> 2.34.1
>
--
With best wishes
Dmitry
prev parent reply other threads:[~2024-11-20 11:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-20 5:04 [PATCH drm-next] drm/msm/dp: Fix potential division by zero issue Dheeraj Reddy Jonnalagadda
2024-11-20 11:02 ` Dmitry Baryshkov [this message]
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=piembwzz7x6plsps3umjg3b3pi2ii44svmeii3wwtydtriceny@uqq7ck2ge5zz \
--to=dmitry.baryshkov@linaro.org \
--cc=airlied@gmail.com \
--cc=dheeraj.linuxdev@gmail.com \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_bjorande@quicinc.com \
--cc=quic_khsieh@quicinc.com \
--cc=quic_parellan@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox