From: sashiko-bot@kernel.org
To: "Kyrie Wu" <kyrie.wu@mediatek.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH v18 11/13] media: mediatek: jpeg: add jpeg compatible
Date: Sat, 10 Oct 2026 08:21:26 +0000 [thread overview]
Message-ID: <sashiko-outbox-166336@kernel.org> (raw)
In-Reply-To: <34f85b6c0aef3cacad9644c81ef78a7e83575935.1791614327.git.kyrie.wu@mediatek.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] media: mediatek: jpeg: incorrect STALL address extension calculation in 34-bit mode
--
commit ab319417645f402435984f080997cd803d5661ce
Author: Kyrie Wu <kyrie.wu@mediatek.com>
media: mediatek: jpeg: add jpeg compatible
Add jpeg dec and enc compatible for mt8196
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 0907960db1436..8e96501a4f9fa 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1919,6 +1919,20 @@ static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = {
> .jpeg_worker = mtk_jpegenc_worker,
> };
>
> +static struct mtk_jpeg_variant mtk8196_jpegenc_drvdata = {
> + .formats = mtk_jpeg_enc_formats,
> + .num_formats = MTK_JPEG_ENC_NUM_FORMATS,
> + .qops = &mtk_jpeg_enc_qops,
> + .m2m_ops = &mtk_jpeg_multicore_enc_m2m_ops,
> + .dev_name = "mtk-jpeg-enc",
> + .ioctl_ops = &mtk_jpeg_enc_ioctl_ops,
> + .out_q_default_fourcc = V4L2_PIX_FMT_YUYV,
> + .cap_q_default_fourcc = V4L2_PIX_FMT_JPEG,
> + .multi_core = true,
> + .jpeg_worker = mtk_jpegenc_worker,
> + .support_34bit = true,
[Severity: High]
This problem wasn't introduced by this patch, but setting support_34bit to true
makes a broken 34-bit code path reachable for the first time.
In drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c:mtk_jpeg_set_enc_dst(),
the STALL address extension is calculated by adding the buffer size directly to
the 2-bit extension address:
if (support_34bit) {
addr_ext = FIELD_PREP(MTK_JPEG_ADDR_MASK, upper_32_bits(dma_addr));
writel(addr_ext, base + JPEG_ENC_DEST_ADDR0_EXT);
writel(addr_ext + size, base + JPEG_ENC_STALL_ADDR0_EXT);
}
Since size is in bytes, won't adding it to the 2-bit addr_ext write a massively
out-of-bounds value to the hardware extension register, rather than correctly
extracting the upper 32 bits of dma_addr + size?
Could this corrupt the DMA engine's STALL boundary setup and risk memory
corruption or IOMMU faults?
> +};
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791614327.git.kyrie.wu@mediatek.com?part=11
next prev parent reply other threads:[~2026-10-10 8:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 8:07 [PATCH v18 00/13] media: mediatek: jpeg: add MT8196 JPEG support Kyrie Wu
2026-10-10 8:07 ` [PATCH v18 01/13] media: mediatek: jpeg: fix jpeg cores' amounts setting Kyrie Wu
2026-10-10 8:16 ` sashiko-bot
2026-10-10 8:07 ` [PATCH v18 02/13] media: mediatek: jpeg: fix jpeg buffer payload size setting Kyrie Wu
2026-10-10 8:07 ` [PATCH v18 03/13] media: mediatek: jpeg: fix buffer structure size and layout Kyrie Wu
2026-10-10 8:07 ` [PATCH v18 04/13] media: mediatek: jpeg: Fix buffer completion on multi-core streaming stop Kyrie Wu
2026-10-10 8:17 ` sashiko-bot
2026-10-10 8:07 ` [PATCH v18 05/13] media: mediatek: jpeg: Fix multi-core clk suspend and resume setting Kyrie Wu
2026-10-10 8:24 ` sashiko-bot
2026-10-10 8:07 ` [PATCH v18 06/13] media: mediatek: jpeg: fix buffer state update timing Kyrie Wu
2026-10-10 8:19 ` sashiko-bot
2026-10-10 8:07 ` [PATCH v18 07/13] media: mediatek: jpeg: fix resolution change event handling in decoder Kyrie Wu
2026-10-10 8:24 ` sashiko-bot
2026-10-10 8:07 ` [PATCH v18 08/13] media: mediatek: jpeg: fix remove buffer removal timing for multi-core Kyrie Wu
2026-10-10 8:18 ` sashiko-bot
2026-10-10 8:07 ` [PATCH v18 09/13] media: dt-bindings: mediatek,jpeg: Add mediatek, mt8196-jpgdec compatible Kyrie Wu
2026-10-10 8:07 ` [PATCH v18 10/13] media: dt-bindings: mediatek,jpeg: Add mediatek, mt8196-jpgenc compatible Kyrie Wu
2026-10-10 8:18 ` sashiko-bot
2026-10-10 8:07 ` [PATCH v18 11/13] media: mediatek: jpeg: add jpeg compatible Kyrie Wu
2026-10-10 8:21 ` sashiko-bot [this message]
2026-10-10 8:07 ` [PATCH v18 12/13] dt-bindings: mediatek: Add MT8196 JPEG SMMU bindings Kyrie Wu
2026-10-10 8:07 ` [PATCH v18 13/13] media: mediatek: jpeg: add jpeg smmu sid setting Kyrie Wu
2026-10-10 8:23 ` 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=sashiko-outbox-166336@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=kyrie.wu@mediatek.com \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox