Commit 811d586b authored by Julien's avatar Julien Committed by David Thach

libxdma: fix string overflow

set name length to 16 and use snprintf
parent a1d510f4
...@@ -3074,7 +3074,7 @@ static int engine_init(struct xdma_engine *engine, struct xdma_dev *xdev, ...@@ -3074,7 +3074,7 @@ static int engine_init(struct xdma_engine *engine, struct xdma_dev *xdev,
/* remember SG DMA direction */ /* remember SG DMA direction */
engine->dir = dir; engine->dir = dir;
sprintf(engine->name, "%d-%s%d-%s", xdev->idx, snprintf(engine->name, sizeof(engine->name), "%d-%s%d-%s", xdev->idx,
(dir == DMA_TO_DEVICE) ? "H2C" : "C2H", channel, (dir == DMA_TO_DEVICE) ? "H2C" : "C2H", channel,
engine->streaming ? "ST" : "MM"); engine->streaming ? "ST" : "MM");
......
...@@ -475,7 +475,7 @@ struct xdma_request_cb { ...@@ -475,7 +475,7 @@ struct xdma_request_cb {
struct xdma_engine { struct xdma_engine {
unsigned long magic; /* structure ID for sanity checks */ unsigned long magic; /* structure ID for sanity checks */
struct xdma_dev *xdev; /* parent device */ struct xdma_dev *xdev; /* parent device */
char name[5]; /* name of this engine */ char name[16]; /* name of this engine */
int version; /* version of this engine */ int version; /* version of this engine */
//dev_t cdevno; /* character device major:minor */ //dev_t cdevno; /* character device major:minor */
//struct cdev cdev; /* character device (embedded struct) */ //struct cdev cdev; /* character device (embedded struct) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment