diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-07-18 05:07:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-07-18 05:07:51 -0400 |
commit | eb4965344965530411359891214cd6fcab483649 (patch) | |
tree | d6007042cd1ca2ac1f2378ea93ce3878bec89d0b /net/netlink | |
parent | f77ae9390438409b535f3b1854672e54120cd38b (diff) |
[NETLINK]: negative groups in netlink_setsockopt
Reading netlink_setsockopt it's not immediately clear why there isn't a
bug when you pass in negative numbers, the reason being that the >=
comparison is really unsigned although 'val' is signed because
nlk->ngroups is unsigned. Make 'val' unsigned too.
[ Update the get_user() cast to match. --DaveM ]
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/af_netlink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index a3c8e692f493..641cfbc278d8 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1012,13 +1012,14 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, | |||
1012 | { | 1012 | { |
1013 | struct sock *sk = sock->sk; | 1013 | struct sock *sk = sock->sk; |
1014 | struct netlink_sock *nlk = nlk_sk(sk); | 1014 | struct netlink_sock *nlk = nlk_sk(sk); |
1015 | int val = 0, err; | 1015 | unsigned int val = 0; |
1016 | int err; | ||
1016 | 1017 | ||
1017 | if (level != SOL_NETLINK) | 1018 | if (level != SOL_NETLINK) |
1018 | return -ENOPROTOOPT; | 1019 | return -ENOPROTOOPT; |
1019 | 1020 | ||
1020 | if (optlen >= sizeof(int) && | 1021 | if (optlen >= sizeof(int) && |
1021 | get_user(val, (int __user *)optval)) | 1022 | get_user(val, (unsigned int __user *)optval)) |
1022 | return -EFAULT; | 1023 | return -EFAULT; |
1023 | 1024 | ||
1024 | switch (optname) { | 1025 | switch (optname) { |