diff --git a/net/core/neighbour.c b/net/core/neighbour.c index eae73efa9245f9a1467b61508a525fb2c6a9c3e6..4fc601f9cd068b4beb014289f147aca3b3b417e0 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -1940,6 +1940,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, NL_SET_ERR_MSG(extack, "Invalid extended flags"); goto out; } + BUILD_BUG_ON(sizeof(neigh->flags) * BITS_PER_BYTE < + (sizeof(ndm->ndm_flags) * BITS_PER_BYTE + + hweight32(NTF_EXT_MASK))); ndm_flags |= (ext << NTF_EXT_SHIFT); } if (ndm->ndm_ifindex) {