[ovs-dev] [PATCH] ovs-router: fix router entry cast

William Tu u9012063 at gmail.com
Wed Jan 31 19:03:04 UTC 2018


The offsetof(struct ovs_router_entry, cr) should always be 0,
thus the else statement should never be reached.

Signed-off-by: William Tu <u9012063 at gmail.com>
---
 lib/ovs-router.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index cd2ab15fb003..bc8616858a84 100644
--- a/lib/ovs-router.c
+++ b/lib/ovs-router.c
@@ -71,7 +71,7 @@ ovs_router_entry_cast(const struct cls_rule *cr)
     if (offsetof(struct ovs_router_entry, cr) == 0) {
         return CONTAINER_OF(cr, struct ovs_router_entry, cr);
     } else {
-        return cr ? CONTAINER_OF(cr, struct ovs_router_entry, cr) : NULL;
+        OVS_NOT_REACHED();
     }
 }
 
-- 
2.7.4



More information about the dev mailing list