[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] lib/uknetdev: Zero-initialize netdev data



Whenever a network device is registered by a driver to the uknetdev
API, libuknetdev allocates an API-internal data structure that is used
to track the state of the device state. Subsequent API calls are
assuming that this allocation was zero-initialized. Otherwise,
assertions fail unexpectedly.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/uknetdev/netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/uknetdev/netdev.c b/lib/uknetdev/netdev.c
index b0e390e..8f7dd6e 100644
--- a/lib/uknetdev/netdev.c
+++ b/lib/uknetdev/netdev.c
@@ -48,7 +48,7 @@ static struct uk_netdev_data *_alloc_data(struct uk_alloc *a,
 {
        struct uk_netdev_data *data;
 
-       data = uk_malloc(a, sizeof(*data));
+       data = uk_calloc(a, 1, sizeof(*data));
        if (!data)
                return NULL;
 
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.