Commit d1eab9de authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: vchiq_core: Bail out in case of invalid tx_pos

Properly handle the error case in case of an invalid tx_pos.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6f2370d2
...@@ -600,8 +600,10 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) ...@@ -600,8 +600,10 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking)
return NULL; /* No space available */ return NULL; /* No space available */
} }
BUG_ON(tx_pos == if (tx_pos == (state->slot_queue_available * VCHIQ_SLOT_SIZE)) {
(state->slot_queue_available * VCHIQ_SLOT_SIZE)); pr_warn("%s: invalid tx_pos: %d\n", __func__, tx_pos);
return NULL;
}
slot_index = local->slot_queue[ slot_index = local->slot_queue[
SLOT_QUEUE_INDEX_FROM_POS(tx_pos) & SLOT_QUEUE_INDEX_FROM_POS(tx_pos) &
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment