From: Maulik Shah Date: Thu, 21 Feb 2019 12:40:36 +0000 (+0530) Subject: drivers: soc: qcom: rpmh-rsc: Correct check for slot number X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bbeac60f064158aa92b4c72fb50b12231e62cbcd;p=linux.git drivers: soc: qcom: rpmh-rsc: Correct check for slot number The return index value from bitmap_find_next_zero_area can be higher than available slot. So correct the check to return error in such case. Signed-off-by: Maulik Shah Signed-off-by: Raju P.L.S.S.S.N Reviewed-by: Lina Iyer Signed-off-by: Andy Gross --- diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 75bd9a83aef00..e278fc11fe5cf 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -459,7 +459,7 @@ static int find_slots(struct tcs_group *tcs, const struct tcs_request *msg, do { slot = bitmap_find_next_zero_area(tcs->slots, MAX_TCS_SLOTS, i, msg->num_cmds, 0); - if (slot == tcs->num_tcs * tcs->ncpt) + if (slot >= tcs->num_tcs * tcs->ncpt) return -ENOMEM; i += tcs->ncpt; } while (slot + msg->num_cmds - 1 >= i);