[ovs-dev] [PATCHv2] ovs-router: fix router entry cast
William Tu
u9012063 at gmail.com
Wed Jan 31 22:09:30 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 | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index cd2ab15fb003..c68bb3bc9500 100644
--- a/lib/ovs-router.c
+++ b/lib/ovs-router.c
@@ -68,11 +68,7 @@ struct ovs_router_entry {
static struct ovs_router_entry *
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;
- }
+ return cr ? CONTAINER_OF(cr, struct ovs_router_entry, cr) : NULL;
}
static bool
--
2.7.4
More information about the dev
mailing list