]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
dmaengine: xgene: buffer overflow in xgene_dma_init_channels()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 9 Apr 2015 09:05:04 +0000 (12:05 +0300)
committerVinod Koul <vinod.koul@intel.com>
Fri, 17 Apr 2015 18:04:51 +0000 (23:34 +0530)
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>
drivers/dma/xgene-dma.c

index aa61935ee70696b5f17c355b3a09dc5fdfd8da20..06d40427aa0870ce6358cf8f1ec70d5593bae07f 100755 (executable)
@@ -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);
        }
 }