Message ID | 20250109105211.29340-1-abelova@astralinux.ru (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | clk: qcom: clk-rpmh: add explicit casting in clk_rpmh_bcm_recalc_rate | expand |
On Thu, 09. Jan 13:52, Anastasia Belova wrote: > The result of multiplication of aggr_state and unit fields (rate > value) may not fit u32 type. Add explicit casting to a larger > type to prevent overflow. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: 04053f4d23a4 ("clk: qcom: clk-rpmh: Add IPA clock support") > Cc: stable@vger.kernel.org # v5.4+ > Signed-off-by: Anastasia Belova <abelova@astralinux.ru> > --- Already applied here [1], no? [1]: https://lore.kernel.org/lkml/173525273254.1449028.13893672295374918386.b4-ty@kernel.org/ > drivers/clk/qcom/clk-rpmh.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c > index eefc322ce367..e6c33010cfbf 100644 > --- a/drivers/clk/qcom/clk-rpmh.c > +++ b/drivers/clk/qcom/clk-rpmh.c > @@ -329,7 +329,7 @@ static unsigned long clk_rpmh_bcm_recalc_rate(struct clk_hw *hw, > { > struct clk_rpmh *c = to_clk_rpmh(hw); > > - return c->aggr_state * c->unit; > + return (unsigned long)c->aggr_state * c->unit; > } > > static const struct clk_ops clk_rpmh_bcm_ops = { > -- > 2.43.0
Right, I'm sorry to bother you On 1/9/25 3:31 PM, Fedor Pchelkin wrote: > On Thu, 09. Jan 13:52, Anastasia Belova wrote: >> The result of multiplication of aggr_state and unit fields (rate >> value) may not fit u32 type. Add explicit casting to a larger >> type to prevent overflow. >> >> Found by Linux Verification Center (linuxtesting.org) with SVACE. >> >> Fixes: 04053f4d23a4 ("clk: qcom: clk-rpmh: Add IPA clock support") >> Cc: stable@vger.kernel.org # v5.4+ >> Signed-off-by: Anastasia Belova <abelova@astralinux.ru> >> --- > Already applied here [1], no? > > [1]: https://lore.kernel.org/lkml/173525273254.1449028.13893672295374918386.b4-ty@kernel.org/ > >> drivers/clk/qcom/clk-rpmh.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c >> index eefc322ce367..e6c33010cfbf 100644 >> --- a/drivers/clk/qcom/clk-rpmh.c >> +++ b/drivers/clk/qcom/clk-rpmh.c >> @@ -329,7 +329,7 @@ static unsigned long clk_rpmh_bcm_recalc_rate(struct clk_hw *hw, >> { >> struct clk_rpmh *c = to_clk_rpmh(hw); >> >> - return c->aggr_state * c->unit; >> + return (unsigned long)c->aggr_state * c->unit; >> } >> >> static const struct clk_ops clk_rpmh_bcm_ops = { >> -- >> 2.43.0
diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c index eefc322ce367..e6c33010cfbf 100644 --- a/drivers/clk/qcom/clk-rpmh.c +++ b/drivers/clk/qcom/clk-rpmh.c @@ -329,7 +329,7 @@ static unsigned long clk_rpmh_bcm_recalc_rate(struct clk_hw *hw, { struct clk_rpmh *c = to_clk_rpmh(hw); - return c->aggr_state * c->unit; + return (unsigned long)c->aggr_state * c->unit; } static const struct clk_ops clk_rpmh_bcm_ops = {
The result of multiplication of aggr_state and unit fields (rate value) may not fit u32 type. Add explicit casting to a larger type to prevent overflow. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 04053f4d23a4 ("clk: qcom: clk-rpmh: Add IPA clock support") Cc: stable@vger.kernel.org # v5.4+ Signed-off-by: Anastasia Belova <abelova@astralinux.ru> --- drivers/clk/qcom/clk-rpmh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)