From ed1f041842f0c4226a78fcd96ccb8e6a5433ae9d Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 9 Apr 2015 12:05:04 +0300 Subject: dmaengine: xgene: buffer overflow in xgene_dma_init_channels() We put 9 characters into the 8 character name[] array. Let's make the array bigger and change the sprintf() to snprintf(). Signed-off-by: Dan Carpenter Signed-off-by: Vinod Koul --- drivers/dma/xgene-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/dma/xgene-dma.c') diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c index aa61935..06d4042 100755 --- a/drivers/dma/xgene-dma.c +++ b/drivers/dma/xgene-dma.c @@ -314,7 +314,7 @@ struct xgene_dma_chan { struct device *dev; int id; int rx_irq; - char name[8]; + char name[10]; spinlock_t lock; int pending; int max_outstanding; @@ -1876,7 +1876,7 @@ static void xgene_dma_init_channels(struct xgene_dma *pdma) chan->dev = pdma->dev; chan->pdma = pdma; chan->id = i; - sprintf(chan->name, "dmachan%d", chan->id); + snprintf(chan->name, sizeof(chan->name), "dmachan%d", chan->id); } } -- cgit v1.1