aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Vizzarro <Luca.Vizzarro@arm.com>2020-11-11 17:29:35 +0000
committerjimqui01 <54316584+jimqui01@users.noreply.github.com>2020-11-13 10:03:34 +0000
commitf73422868da3eeaa877286545850520e9b431055 (patch)
treed3c9300c528f1c2b6c61e9307712f3a3798c68fa
parent6738315d415ad8ef02bf1b31cf028866b27bd27b (diff)
juno/mod_hdlcd: Fix invalid rate response
With the premise that a clock rate is 64 bits long, this commit fixes the behaviour where the Juno HDLCD clock driver takes only the lower 32 bits of the rate ignoring the remaining upper half. With the assumption that only 32 bits are therefore required, this commit includes a check whether the upper 32 bits are zero, enforcing this requirement and returning FWK_E_PARAM if any provided rate is bigger than 32 bits. Change-Id: I0c72432a91d9e4a43c44b36e343a884058ebada9 Signed-off-by: Luca Vizzarro <Luca.Vizzarro@arm.com>
-rw-r--r--product/juno/module/juno_hdlcd/src/mod_juno_hdlcd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/product/juno/module/juno_hdlcd/src/mod_juno_hdlcd.c b/product/juno/module/juno_hdlcd/src/mod_juno_hdlcd.c
index d720a197..296cad6f 100644
--- a/product/juno/module/juno_hdlcd/src/mod_juno_hdlcd.c
+++ b/product/juno/module/juno_hdlcd/src/mod_juno_hdlcd.c
@@ -164,6 +164,10 @@ static int juno_hdlcd_set_rate(fwk_id_t clock_id, uint64_t rate,
ctx = ctx_table + fwk_id_get_element_idx(clock_id);
+ /* Only the first 32-bits are taken */
+ if (rate > UINT32_MAX)
+ return FWK_E_RANGE;
+
status = round_rate(ctx, round_mode, rate, &rounded_rate);
if (status != FWK_SUCCESS)
return status;