Skip to content

Commit

Permalink
Blackfin: fix read buffer overflow
Browse files Browse the repository at this point in the history
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
  • Loading branch information
Roel Kluin authored and Mike Frysinger committed Sep 17, 2009
1 parent 0e101ec commit ac86075
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/blackfin/kernel/bfin_dma_5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ EXPORT_SYMBOL(request_dma);

int set_dma_callback(unsigned int channel, irq_handler_t callback, void *data)
{
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_DMA_CHANNELS));
BUG_ON(channel >= MAX_DMA_CHANNELS ||
dma_ch[channel].chan_status == DMA_CHANNEL_FREE);

if (callback != NULL) {
int ret;
Expand Down Expand Up @@ -182,8 +182,8 @@ static void clear_dma_buffer(unsigned int channel)
void free_dma(unsigned int channel)
{
pr_debug("freedma() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE
&& channel < MAX_DMA_CHANNELS));
BUG_ON(channel >= MAX_DMA_CHANNELS ||
dma_ch[channel].chan_status == DMA_CHANNEL_FREE);

/* Halt the DMA */
disable_dma(channel);
Expand Down

0 comments on commit ac86075

Please sign in to comment.