summaryrefslogtreecommitdiffstats
path: root/net/decnet/dn_neigh.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2022-05-08 03:22:17 -0700
committerPaolo Abeni <pabeni@redhat.com>2022-05-10 12:21:51 +0200
commitdc5306a8c0eace6c113aded2e36ae5e15fdca4d7 (patch)
tree9871932c6b1920bdf99797282deb89d92f2de435 /net/decnet/dn_neigh.c
parent1809c30b6e5a83a1de1435fe01aaa4de4d626a7c (diff)
downloadlinux-dc5306a8c0eace6c113aded2e36ae5e15fdca4d7.tar.gz
linux-dc5306a8c0eace6c113aded2e36ae5e15fdca4d7.tar.bz2
linux-dc5306a8c0eace6c113aded2e36ae5e15fdca4d7.zip
decnet: Use container_of() for struct dn_neigh casts
Clang's structure layout randomization feature gets upset when it sees struct neighbor (which is randomized) cast to struct dn_neigh: net/decnet/dn_route.c:1123:15: error: casting from randomized structure pointer type 'struct neighbour *' to 'struct dn_neigh *' gateway = ((struct dn_neigh *)neigh)->addr; ^ Update all the open-coded casts to use container_of() to do the conversion instead of depending on strict member ordering. Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/lkml/202205041247.WKBEHGS5-lkp@intel.com Cc: "David S. Miller" <davem@davemloft.net> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: Yajun Deng <yajun.deng@linux.dev> Cc: Zheng Yongjun <zhengyongjun3@huawei.com> Cc: Bill Wendling <morbo@google.com> Cc: linux-decnet-user@lists.sourceforge.net Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20220508102217.2647184-1-keescook@chromium.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/decnet/dn_neigh.c')
-rw-r--r--net/decnet/dn_neigh.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 94b306f6d551..fbd98ac853ea 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -426,7 +426,8 @@ int dn_neigh_router_hello(struct net *net, struct sock *sk, struct sk_buff *skb)
if (!dn_db->router) {
dn_db->router = neigh_clone(neigh);
} else {
- if (msg->priority > ((struct dn_neigh *)dn_db->router)->priority)
+ if (msg->priority > container_of(dn_db->router,
+ struct dn_neigh, n)->priority)
neigh_release(xchg(&dn_db->router, neigh_clone(neigh)));
}
}