[ovs-dev] [PATCH] datapath: Use correct type while allocating flex array.

Pravin B Shelar pshelar at nicira.com
Thu Jun 6 21:29:26 UTC 2013


Flex array is used to allocate hash buckets which is type struct
hlist_head, but we use `struct hlist_head *` to calculate
array size.  Since hlist_head is of size pointer it works fine.

Following patch use correct type.

Signed-off-by: Pravin B Shelar <pshelar at nicira.com>
---
 datapath/flow.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index 7f897bd..8dc0a37 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -241,7 +241,7 @@ static struct flex_array *alloc_buckets(unsigned int n_buckets)
 	struct flex_array *buckets;
 	int i, err;
 
-	buckets = flex_array_alloc(sizeof(struct hlist_head *),
+	buckets = flex_array_alloc(sizeof(struct hlist_head),
 				   n_buckets, GFP_KERNEL);
 	if (!buckets)
 		return NULL;
-- 
1.7.1




More information about the dev mailing list