From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Karol Przybylski <karprzy7@gmail.com>
Cc: tomi.valkeinen@ideasonboard.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
michal.simek@amd.com, dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: zynqmp_dp: Fix integer overflow in zynqmp_dp_rate_get()
Date: Wed, 11 Dec 2024 14:59:36 +0200 [thread overview]
Message-ID: <20241211125936.GA23711@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20241211122026.797511-1-karprzy7@gmail.com>
Hi Karol,
Thank you for the patch.
On Wed, Dec 11, 2024 at 01:20:26PM +0100, Karol Przybylski wrote:
> This patch fixes a potential integer overflow in the zynqmp_dp_rate_get() function.
>
> The issue comes up when the expression drm_dp_bw_code_to_link_rate(dp->test.bw_code) * 10000 is evaluated using 32-bit arithmetic.
Please wrap your commit message text to 82 columns.
>
> Now the constant is casted to compatible u64 type.
>
> Resolves CID 1636340 and CID 1635811
>
Does this need a Fixes: tag ? How about 'Cc: stable@vger.kernel.org' to
get it backported to stable kernels ?
> Signed-off-by: Karol Przybylski <karprzy7@gmail.com>
> ---
> drivers/gpu/drm/xlnx/zynqmp_dp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> index 25c5dc61e..55e92344b 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c
> @@ -2190,7 +2190,7 @@ static int zynqmp_dp_rate_get(void *data, u64 *val)
> struct zynqmp_dp *dp = data;
>
> mutex_lock(&dp->lock);
> - *val = drm_dp_bw_code_to_link_rate(dp->test.bw_code) * 10000;
> + *val = drm_dp_bw_code_to_link_rate(dp->test.bw_code) * (u64)10000;
You can also make the integer a 64-bit constant with
*val = drm_dp_bw_code_to_link_rate(dp->test.bw_code) * 10000ULL;
> mutex_unlock(&dp->lock);
> return 0;
> }
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-12-11 13:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 12:20 Karol Przybylski
2024-12-11 12:59 ` Laurent Pinchart [this message]
2024-12-12 9:34 ` Karol P
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=20241211125936.GA23711@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karprzy7@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=michal.simek@amd.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®