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

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



Hey Sharan,

On 03.12.18 16:13, Sharan Santhanam wrote:
Hello Simon,

This patch looks good.

Thanks.


As a suggestion, I believe it is wise to extend uk_alloc to add another allocator function which allocates memory and zeros out it.

Hum, yeah, I was thinking about this too. We could add this as a wrapper to libukalloc.


Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>

Thanks & Regards
Sharan

Thanks,

Simon


On 12/03/2018 11:23 AM, Simon Kuenzer wrote:
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;


_______________________________________________
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®.