summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Norris <briannorris@google.com>2016-02-29 17:38:34 -0800
committerBrian Norris <briannorris@google.com>2016-03-01 11:59:28 -0800
commit896d0a62196d2fcbe95c311a0beaff6e33d7b61f (patch)
tree462c8bfdd0108086c7bd394e96611a2624c416fe
parent0cf03042cff1084ff642944e5fd0e79c119d2eac (diff)
ANDROID: net: fix 'const' warnings
See the following build log splats. The sock_i_uid() helper doesn't quite treat the parameter as 'const' (it acquires a member lock), but this cast is the same approach taken by other callers in this file, so I don't feel too bad about the fix. CC net/ipv4/inet_connection_sock.o CC net/ipv6/inet6_connection_sock.o net/ipv6/inet6_connection_sock.c: In function ‘inet6_csk_route_req’: net/ipv6/inet6_connection_sock.c:89:2: warning: passing argument 1 of ‘sock_i_uid’ discards ‘const’ qualifier from pointer target type [enabled by default] In file included from include/linux/tcp.h:22:0, from include/linux/ipv6.h:73, from net/ipv6/inet6_connection_sock.c:18: include/net/sock.h:1689:8: note: expected ‘struct sock *’ but argument is of type ‘const struct sock *’ net/ipv4/inet_connection_sock.c: In function ‘inet_csk_route_req’: net/ipv4/inet_connection_sock.c:423:7: warning: passing argument 1 of ‘sock_i_uid’ discards ‘const’ qualifier from pointer target type [enabled by default] In file included from include/net/inet_sock.h:27:0, from include/net/inet_connection_sock.h:23, from net/ipv4/inet_connection_sock.c:19: include/net/sock.h:1689:8: note: expected ‘struct sock *’ but argument is of type ‘const struct sock *’ net/ipv4/inet_connection_sock.c: In function ‘inet_csk_route_child_sock’: net/ipv4/inet_connection_sock.c:460:7: warning: passing argument 1 of ‘sock_i_uid’ discards ‘const’ qualifier from pointer target type [enabled by default] In file included from include/net/inet_sock.h:27:0, from include/net/inet_connection_sock.h:23, from net/ipv4/inet_connection_sock.c:19: include/net/sock.h:1689:8: note: expected ‘struct sock *’ but argument is of type ‘const struct sock *’ Change-Id: I5c156fc1a81f90323717bffd93c31d205b85620c Signed-off-by: Brian Norris <briannorris@google.com>
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv6/inet6_connection_sock.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index a4cfa14c73ee..728414dcea3b 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -420,7 +420,7 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk,
sk->sk_protocol, inet_sk_flowi_flags(sk),
(opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr,
ireq->ir_loc_addr, ireq->ir_rmt_port,
- htons(ireq->ir_num), sock_i_uid(sk));
+ htons(ireq->ir_num), sock_i_uid((struct sock *)sk));
security_req_classify_flow(req, flowi4_to_flowi(fl4));
rt = ip_route_output_flow(net, fl4, sk);
if (IS_ERR(rt))
@@ -457,7 +457,7 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk,
sk->sk_protocol, inet_sk_flowi_flags(sk),
(opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr,
ireq->ir_loc_addr, ireq->ir_rmt_port,
- htons(ireq->ir_num), sock_i_uid(sk));
+ htons(ireq->ir_num), sock_i_uid((struct sock *)sk));
security_req_classify_flow(req, flowi4_to_flowi(fl4));
rt = ip_route_output_flow(net, fl4, sk);
if (IS_ERR(rt))
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 7b214652768e..897bb6eb5751 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -86,7 +86,7 @@ struct dst_entry *inet6_csk_route_req(const struct sock *sk,
fl6->flowi6_mark = ireq->ir_mark;
fl6->fl6_dport = ireq->ir_rmt_port;
fl6->fl6_sport = htons(ireq->ir_num);
- fl6->flowi6_uid = sock_i_uid(sk);
+ fl6->flowi6_uid = sock_i_uid((struct sock *)sk);
security_req_classify_flow(req, flowi6_to_flowi(fl6));
dst = ip6_dst_lookup_flow(sk, fl6, final_p);