diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 10cdd150b000..ff382bb578f1 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -927,7 +927,11 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, if (err) return err; } - groups &= (1UL << nlk->ngroups) - 1; + + if (nlk->ngroups == 0) + groups = 0; + else + groups &= (1ULL << nlk->ngroups) - 1; if (nlk->portid) if (nladdr->nl_pid != nlk->portid)