Ensure a valid class is found before calling it's function pointer.
If it's not found, call ovs_assert().

Signed-off-by: Eelco Chaudron <[email protected]>
--
v2: - Call ovs_assert() in case the class does not exists.
---
 ofproto/ofproto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 260389865..ef615e59c 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -1896,6 +1896,7 @@ ofproto_type_run(const char *datapath_type)
 
     datapath_type = ofproto_normalize_type(datapath_type);
     class = ofproto_class_find__(datapath_type);
+    ovs_assert(class);
 
     error = class->type_run ? class->type_run(datapath_type) : 0;
     if (error && error != EAGAIN) {
@@ -1912,6 +1913,7 @@ ofproto_type_wait(const char *datapath_type)
 
     datapath_type = ofproto_normalize_type(datapath_type);
     class = ofproto_class_find__(datapath_type);
+    ovs_assert(class);
 
     if (class->type_wait) {
         class->type_wait(datapath_type);
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to