Currently, the device object is only manipulated by the dma/idxd bus
callbacks and EAL is not looking too much into this object.

However, in the next refactoring, EAL will expect a clean object, like
when checking that the device has been already probed
(iow dev->driver != NULL).

Request a 0'd object when allocating.

Reported-by: Bruce Richardson <[email protected]>
Signed-off-by: David Marchand <[email protected]>
---
 drivers/dma/idxd/idxd_bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c
index 291cd6c707..f267c20a59 100644
--- a/drivers/dma/idxd/idxd_bus.c
+++ b/drivers/dma/idxd/idxd_bus.c
@@ -322,7 +322,7 @@ dsa_scan(void)
                }
                IDXD_PMD_DEBUG("%s(): found %s/%s", __func__, path, wq->d_name);
 
-               dev = malloc(sizeof(*dev));
+               dev = calloc(1, sizeof(*dev));
                if (dev == NULL) {
                        closedir(dev_dir);
                        return -ENOMEM;
-- 
2.53.0

Reply via email to