Skip to content

Commit

Permalink
staging: vchiq_core: Bail out in case of invalid tx_pos
Browse files Browse the repository at this point in the history
Properly handle the error case in case of an invalid tx_pos.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Stefan Wahren authored and Greg Kroah-Hartman committed May 29, 2017
1 parent 6f2370d commit d1eab9d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,10 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking)
return NULL; /* No space available */
}

BUG_ON(tx_pos ==
(state->slot_queue_available * VCHIQ_SLOT_SIZE));
if (tx_pos == (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_QUEUE_INDEX_FROM_POS(tx_pos) &
Expand Down

0 comments on commit d1eab9d

Please sign in to comment.