summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Tu <u9012063@gmail.com>2018-01-31 14:09:30 -0800
committerBen Pfaff <blp@ovn.org>2018-02-01 13:27:52 -0800
commit53d416af570934a92d8c2f6471229599e53cbe6f (patch)
tree3955df5e467deb882189a0ae389b87ea619c8db7
parentc9ccdec7516560cc859e90ab87557600fc9bdf58 (diff)
downloadopenvswitch-53d416af570934a92d8c2f6471229599e53cbe6f.tar.gz
ovs-router: fix router entry cast
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@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--lib/ovs-router.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index e6cc81fd0..0f1103b0e 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