From: sashiko-bot@kernel.org
To: "Daniel Golle" <daniel@makrotopia.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 3/5] drm/bridge: it6505: guard against zero channel count in audio infoframe
Date: Wed, 22 Jul 2026 01:16:31 +0000 [thread overview]
Message-ID: <20260722011632.2FCB01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <94721d5c75645a574263cc849249c56e504c2ade.1784681487.git.daniel@makrotopia.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Kernel panic due to division by zero when calculating audio input frequency.
- [High] Kernel panic due to division by zero when calculating video pixel clock.
--
--- Patch [3]: [PATCH v4 3/5] drm/bridge: it6505: guard against zero channel count in audio infoframe ---
commit 8ace85a52fcbf9bce4f2a154064b6799263b545d
Author: Daniel Golle <daniel@makrotopia.org>
Subject: drm/bridge: it6505: guard against zero channel count in audio infoframe
This commit guards against a zero channel count in it6505_enable_audio_infoframe()
to prevent an out-of-bounds stack read. It also fixes a debug print logging an
incorrect channel count on failure.
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 2a8298ee6c03c..443ea55797441 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
[ ... ]
While reviewing this, I noticed a couple of pre-existing issues in this file:
drivers/gpu/drm/bridge/ite-it6505.c:it6505_calc_video_info() {
...
if (sum == 0) {
DRM_DEV_DEBUG_DRIVER(dev, "calc video timing error");
return;
}
sum /= 3;
pclk = 13500 * 2048 / sum;
...
}
[Severity: High]
This is a pre-existing issue, but can this integer division shrink small sums
to 0?
If the accumulated readings are very small (e.g., sum is 1 or 2), the
integer division sum /= 3 will truncate the sum to 0.
The subsequent division for pclk will divide by zero and panic the kernel.
Should there be a check to ensure sum is still non-zero after the division
by 3?
[ ... ]
> @@ -1575,6 +1575,9 @@ static void it6505_enable_audio_infoframe(struct it6505 *it6505)
> struct device *dev = it6505->dev;
> u8 audio_info_ca[] = { 0x00, 0x00, 0x01, 0x03, 0x07, 0x0B, 0x0F, 0x1F };
>
> + if (!it6505->audio.channel_count)
> + return;
> +
> DRM_DEV_DEBUG_DRIVER(dev, "infoframe channel_allocation:0x%02x",
> audio_info_ca[it6505->audio.channel_count - 1]);
>
drivers/gpu/drm/bridge/ite-it6505.c:it6505_enable_audio() {
...
regbe = it6505_read(it6505, REG_AUDIO_INPUT_FREQ);
DRM_DEV_DEBUG_DRIVER(dev, "regbe:0x%02x audio input fs: %d.%d kHz",
regbe, 6750 / regbe, (6750 % regbe) * 10 / regbe);
...
}
[Severity: High]
This isn't a bug introduced by this patch, but is it possible for regbe to
be 0 here?
If the hardware measures no audio clock, this register could return 0.
The debug print macro then divides by regbe, which would cause a kernel
panic due to division by zero.
Could we check if regbe is non-zero before using it as a divisor?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784681487.git.daniel@makrotopia.org?part=3
next prev parent reply other threads:[~2026-07-22 1:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 0:58 [PATCH v4 0/5] drm/bridge: it6505: DP audio support + shared-DAI hw_params fix Daniel Golle
2026-07-22 0:59 ` [PATCH v4 1/5] drm/bridge: it6505: quiesce event sources and work on remove() Daniel Golle
2026-07-22 1:18 ` sashiko-bot
2026-07-22 0:59 ` [PATCH v4 2/5] drm/bridge: it6505: disable runtime PM on remove Daniel Golle
2026-07-22 1:21 ` sashiko-bot
2026-07-22 0:59 ` [PATCH v4 3/5] drm/bridge: it6505: guard against zero channel count in audio infoframe Daniel Golle
2026-07-22 1:16 ` sashiko-bot [this message]
2026-07-22 1:00 ` [PATCH v4 4/5] drm/bridge: it6505: Add audio support Daniel Golle
2026-07-22 1:15 ` sashiko-bot
2026-07-22 1:00 ` [PATCH v4 5/5] drm/bridge: it6505: Don't reject audio hw_params without an encoder Daniel Golle
2026-07-22 1:12 ` sashiko-bot
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=20260722011632.2FCB01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=daniel@makrotopia.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.