提交 4908067b 编写于 作者: H Heinrich Schuchardt 提交者: Tom Rini

dma: bcm6348: incorrect buffer allocation

Calling calloc() for 0 members does not make any sense.
Setting ch_priv->busy_desc = NULL for ch_priv->desc_cnt > 0 is equally
unreasonable.

The current code will lead to a NULL dereference in bcm6348_iudma_enable().

The assignments for ch_priv->busy_desc are obviously swapped.
Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
上级 9e9a530a
......@@ -313,10 +313,10 @@ static int bcm6348_iudma_request(struct dma *dma)
ch_priv->desc_id = 0;
if (bcm6348_iudma_chan_is_rx(dma->id)) {
ch_priv->desc_cnt = 0;
ch_priv->busy_desc = calloc(ch_priv->desc_cnt, sizeof(bool));
ch_priv->busy_desc = NULL;
} else {
ch_priv->desc_cnt = ch_priv->dma_ring_size;
ch_priv->busy_desc = NULL;
ch_priv->busy_desc = calloc(ch_priv->desc_cnt, sizeof(bool));
}
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册