we can save container_of computation and return dst directly,
since dst is always first member of struct rtable, and any
breaking will be caught by BUILD_BUG_ON in route.h

    include/net/route.h:    BUILD_BUG_ON(offsetof(struct rtable, dst) != 0);

Signed-off-by: Li RongQing <lirongq...@baidu.com>
---
 net/core/dst_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c
index 64cef977484a..0753838480fd 100644
--- a/net/core/dst_cache.c
+++ b/net/core/dst_cache.c
@@ -87,7 +87,7 @@ struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, 
__be32 *saddr)
                return NULL;
 
        *saddr = idst->in_saddr.s_addr;
-       return container_of(dst, struct rtable, dst);
+       return (struct rtable *)dst;
 }
 EXPORT_SYMBOL_GPL(dst_cache_get_ip4);
 
-- 
2.16.2

Reply via email to