Skip to content

Commit

Permalink
scsipi_base: Check whether loop was ended prematurely
Browse files Browse the repository at this point in the history
Without this we might end up with a bit shift of -1.
  • Loading branch information
reinauer committed Jan 26, 2024
1 parent e88881c commit 401c74d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scsipi_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ scsipi_get_tag(struct scsipi_xfer *xs)
if (bit != 0)
break;
}
#ifdef DIAGNOSTIC
if (word == PERIPH_NTAGWORDS) {
#ifdef DIAGNOSTIC
scsipi_printaddr(periph);
#endif
printf("no free tags\n");
panic("scsipi_get_tag");
}
#endif

bit -= 1;
periph->periph_freetags[word] &= ~(1U << bit);
Expand Down

0 comments on commit 401c74d

Please sign in to comment.