From: Stephen Boyd <sboyd@kernel.org>
To: "AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Chen-Yu Tsai" <wenst@chromium.org>,
"Chun-Jie Chen" <chun-jie.chen@mediatek.com>,
"Daniel Golle" <daniel@makrotopia.org>,
"Ikjoon Jang" <ikjn@chromium.org>,
"Laura Nao" <laura.nao@collabora.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Michael Turquette" <mturquette@baylibre.com>,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
"Sam Shih" <sam.shih@mediatek.com>,
"Weiyi Lu" <weiyi.lu@mediatek.com>,
linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v2 3/3] clk: mediatek: mt7988: use MUX_CLR_SET for gate-less muxes
Date: Tue, 28 Apr 2026 19:06:09 -0700 [thread overview]
Message-ID: <177742836924.5403.8826035930365293683@localhost.localdomain> (raw)
In-Reply-To: <d1a9b393d9929dc670dc6d5bfcc5cd43561d0be4.1774499536.git.daniel@makrotopia.org>
Quoting Daniel Golle (2026-03-25 22:11:12)
> All 19 muxes in the infra_muxes[] array are pure mux selectors without
> a clock gate or update register, yet they were defined using
> MUX_GATE_CLR_SET_UPD with gate_shift = -1.
>
> This macro assigns mtk_mux_gate_clr_set_upd_ops, whose
> enable/disable/is_enabled callbacks perform BIT(gate_shift). Since
> gate_shift is stored as u8, the -1 truncates to 255, causing a
> shift-out-of-bounds at runtime:
>
> UBSAN: shift-out-of-bounds in drivers/clk/mediatek/clk-mux.c:76:8
> shift exponent 255 is too large for 64-bit type 'long unsigned int'
>
> UBSAN: shift-out-of-bounds in drivers/clk/mediatek/clk-mux.c:102:4
> shift exponent 255 is too large for 64-bit type 'long unsigned int'
>
> UBSAN: shift-out-of-bounds in drivers/clk/mediatek/clk-mux.c:122:16
> shift exponent 255 is too large for 64-bit type 'long unsigned int'
>
> Switch these definitions to MUX_CLR_SET, which uses
> mtk_mux_clr_set_upd_ops (no gate callbacks) and does not require
> callers to pass sentinel values for unused update register fields.
> The actual clock gating for these peripherals is handled by the
> separate GATE_INFRA* definitions further down.
>
> Fixes: 4b4719437d85f ("clk: mediatek: add drivers for MT7988 SoC")
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
Applied to clk-next
prev parent reply other threads:[~2026-04-29 3:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 5:09 [PATCH v2 0/3] clk: mediatek: fix gate-less mux definitions Daniel Golle
2026-03-26 5:09 ` [PATCH v2 1/3] clk: mediatek: add MUX_CLR_SET macro Daniel Golle
2026-03-26 6:37 ` Chen-Yu Tsai
2026-04-29 2:06 ` Stephen Boyd
2026-03-26 5:10 ` [PATCH v2 2/3] clk: mediatek: mt8192: use MUX_CLR_SET Daniel Golle
2026-03-26 6:37 ` Chen-Yu Tsai
2026-04-29 2:06 ` Stephen Boyd
2026-03-26 5:11 ` [PATCH v2 3/3] clk: mediatek: mt7988: use MUX_CLR_SET for gate-less muxes Daniel Golle
2026-03-26 6:39 ` Chen-Yu Tsai
2026-04-29 2:06 ` Stephen Boyd [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=177742836924.5403.8826035930365293683@localhost.localdomain \
--to=sboyd@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chun-jie.chen@mediatek.com \
--cc=daniel@makrotopia.org \
--cc=ikjn@chromium.org \
--cc=laura.nao@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mturquette@baylibre.com \
--cc=nfraprado@collabora.com \
--cc=sam.shih@mediatek.com \
--cc=weiyi.lu@mediatek.com \
--cc=wenst@chromium.org \
/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