From 4f27b251f23643c115fce7e36f31268deed6e71b Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Mon, 29 Feb 2016 17:38:34 -0800 Subject: [PATCH] ANDROID: net: fix 'const' warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- net/ipv4/inet_connection_sock.c | 4 ++-- net/ipv6/inet6_connection_sock.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 759f90e1e499..030cd09dd2a2 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); -- 2.34.1