Skip to content

Commit

Permalink
dmaengine: xgene: buffer overflow in xgene_dma_init_channels()
Browse files Browse the repository at this point in the history
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 <dan.carpenter@oracle.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Dan Carpenter authored and Vinod Koul committed Apr 17, 2015
1 parent d7d8e89 commit ed1f041
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/dma/xgene-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit ed1f041

Please sign in to comment.