提交 ac860751 编写于 作者: R Roel Kluin 提交者: Mike Frysinger

Blackfin: fix read buffer overflow

Check whether index is within bounds before testing the element.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
上级 0e101ec1
...@@ -147,8 +147,8 @@ EXPORT_SYMBOL(request_dma); ...@@ -147,8 +147,8 @@ EXPORT_SYMBOL(request_dma);
int set_dma_callback(unsigned int channel, irq_handler_t callback, void *data) int set_dma_callback(unsigned int channel, irq_handler_t callback, void *data)
{ {
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE BUG_ON(channel >= MAX_DMA_CHANNELS ||
&& channel < MAX_DMA_CHANNELS)); dma_ch[channel].chan_status == DMA_CHANNEL_FREE);
if (callback != NULL) { if (callback != NULL) {
int ret; int ret;
...@@ -182,8 +182,8 @@ static void clear_dma_buffer(unsigned int channel) ...@@ -182,8 +182,8 @@ static void clear_dma_buffer(unsigned int channel)
void free_dma(unsigned int channel) void free_dma(unsigned int channel)
{ {
pr_debug("freedma() : BEGIN \n"); pr_debug("freedma() : BEGIN \n");
BUG_ON(!(dma_ch[channel].chan_status != DMA_CHANNEL_FREE BUG_ON(channel >= MAX_DMA_CHANNELS ||
&& channel < MAX_DMA_CHANNELS)); dma_ch[channel].chan_status == DMA_CHANNEL_FREE);
/* Halt the DMA */ /* Halt the DMA */
disable_dma(channel); disable_dma(channel);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册