From a1d3a35518779df0579dd9de0121354b49c68ddc Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Sat, 13 Aug 2005 22:42:25 -0300 Subject: [PATCH] [DCCP]: Fix sparse warnings Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- net/dccp/ccids/ccid3.c | 13 ++++++++----- net/dccp/dccp.h | 13 +++++++++---- net/dccp/ipv4.c | 7 ++----- net/dccp/options.c | 3 ++- net/dccp/packet_history.h | 12 ++++++------ net/dccp/proto.c | 8 +++++--- 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 09274f32a337..21948d023c72 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c @@ -82,12 +82,13 @@ enum ccid3_options { static int ccid3_debug; -struct dccp_tx_hist *ccid3_tx_hist; -struct dccp_rx_hist *ccid3_rx_hist; +static struct dccp_tx_hist *ccid3_tx_hist; +static struct dccp_rx_hist *ccid3_rx_hist; static kmem_cache_t *ccid3_loss_interval_hist_slab; -static inline struct ccid3_loss_interval_hist_entry *ccid3_loss_interval_hist_entry_new(int prio) +static inline struct ccid3_loss_interval_hist_entry * + ccid3_loss_interval_hist_entry_new(const unsigned int __nocast prio) { return kmem_cache_alloc(ccid3_loss_interval_hist_slab, prio); } @@ -1593,7 +1594,9 @@ static void ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) * These are integers as per section 8 of RFC3448. We can then divide by 4 * * when we use it. */ -const int ccid3_hc_rx_w[TFRC_RECV_IVAL_F_LENGTH] = { 4, 4, 4, 4, 3, 2, 1, 1, }; +static const int ccid3_hc_rx_w[TFRC_RECV_IVAL_F_LENGTH] = { + 4, 4, 4, 4, 3, 2, 1, 1, +}; /* * args: fvalue - function value to match @@ -1601,7 +1604,7 @@ const int ccid3_hc_rx_w[TFRC_RECV_IVAL_F_LENGTH] = { 4, 4, 4, 4, 3, 2, 1, 1, }; * * both fvalue and p are multiplied by 1,000,000 to use ints */ -u32 calcx_reverse_lookup(u32 fvalue) { +static u32 calcx_reverse_lookup(u32 fvalue) { int ctr = 0; int small; diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 270f19439964..148e8a65a10c 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h @@ -231,19 +231,22 @@ extern void dccp_close(struct sock *sk, long timeout); extern struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, struct request_sock *req); +extern struct sk_buff *dccp_make_reset(struct sock *sk, + struct dst_entry *dst, + enum dccp_reset_codes code); extern int dccp_connect(struct sock *sk); extern int dccp_disconnect(struct sock *sk, int flags); extern int dccp_getsockopt(struct sock *sk, int level, int optname, - char *optval, int *optlen); + char __user *optval, int __user *optlen); +extern int dccp_setsockopt(struct sock *sk, int level, int optname, + char __user *optval, int optlen); extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg); extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t size); extern int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len, int nonblock, int flags, int *addr_len); -extern int dccp_setsockopt(struct sock *sk, int level, int optname, - char *optval, int optlen); extern void dccp_shutdown(struct sock *sk, int how); extern int dccp_v4_checksum(const struct sk_buff *skb, @@ -419,7 +422,9 @@ struct dccp_ackpkts { u8 dccpap_buf[0]; }; -extern struct dccp_ackpkts *dccp_ackpkts_alloc(unsigned int len, int priority); +extern struct dccp_ackpkts * + dccp_ackpkts_alloc(unsigned int len, + const unsigned int __nocast priority); extern void dccp_ackpkts_free(struct dccp_ackpkts *ap); extern int dccp_ackpkts_add(struct dccp_ackpkts *ap, u64 ackno, u8 state); extern void dccp_ackpkts_check_rcv_ackno(struct dccp_ackpkts *ap, diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 42d9c878d4c3..bc3cfc0533cc 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c @@ -617,9 +617,6 @@ out: sock_put(sk); } -extern struct sk_buff *dccp_make_reset(struct sock *sk, struct dst_entry *dst, - enum dccp_reset_codes code); - int dccp_v4_send_reset(struct sock *sk, enum dccp_reset_codes code) { struct sk_buff *skb; @@ -881,7 +878,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk, return &rt->u.dst; } -void dccp_v4_ctl_send_reset(struct sk_buff *rxskb) +static void dccp_v4_ctl_send_reset(struct sk_buff *rxskb) { int err; struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh; @@ -1268,7 +1265,7 @@ static int dccp_v4_init_sock(struct sock *sk) return 0; } -int dccp_v4_destroy_sock(struct sock *sk) +static int dccp_v4_destroy_sock(struct sock *sk) { struct dccp_sock *dp = dccp_sk(sk); diff --git a/net/dccp/options.c b/net/dccp/options.c index fc363aaeedaf..d87d6be7ab10 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c @@ -499,7 +499,8 @@ void dccp_insert_options(struct sock *sk, struct sk_buff *skb) } } -struct dccp_ackpkts *dccp_ackpkts_alloc(unsigned int len, int priority) +struct dccp_ackpkts *dccp_ackpkts_alloc(const unsigned int len, + const unsigned int __nocast priority) { struct dccp_ackpkts *ap = kmalloc(sizeof(*ap) + len, priority); diff --git a/net/dccp/packet_history.h b/net/dccp/packet_history.h index 489fff45ccdf..2e5ba343e3dd 100644 --- a/net/dccp/packet_history.h +++ b/net/dccp/packet_history.h @@ -79,8 +79,8 @@ extern struct dccp_rx_hist_entry * dccp_rx_hist_find_data_packet(const struct list_head *list); static inline struct dccp_tx_hist_entry * - dccp_tx_hist_entry_new(struct dccp_tx_hist *hist, - const int prio) + dccp_tx_hist_entry_new(struct dccp_tx_hist *hist, + const unsigned int __nocast prio) { struct dccp_tx_hist_entry *entry = kmem_cache_alloc(hist->dccptxh_slab, prio); @@ -127,10 +127,10 @@ static inline struct dccp_tx_hist_entry * } static inline struct dccp_rx_hist_entry * - dccp_rx_hist_entry_new(struct dccp_rx_hist *hist, - const u32 ndp, - const struct sk_buff *skb, - const int prio) + dccp_rx_hist_entry_new(struct dccp_rx_hist *hist, + const u32 ndp, + const struct sk_buff *skb, + const unsigned int __nocast prio) { struct dccp_rx_hist_entry *entry = kmem_cache_alloc(hist->dccprxh_slab, prio); diff --git a/net/dccp/proto.c b/net/dccp/proto.c index be0669242069..0b715ceb38b5 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -147,7 +147,7 @@ int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg) } int dccp_setsockopt(struct sock *sk, int level, int optname, - char *optval, int optlen) + char __user *optval, int optlen) { dccp_pr_debug("entry\n"); @@ -158,7 +158,7 @@ int dccp_setsockopt(struct sock *sk, int level, int optname, } int dccp_getsockopt(struct sock *sk, int level, int optname, - char *optval, int *optlen) + char __user *optval, int __user *optlen) { dccp_pr_debug("entry\n"); @@ -439,7 +439,7 @@ void dccp_shutdown(struct sock *sk, int how) dccp_pr_debug("entry\n"); } -struct proto_ops inet_dccp_ops = { +static struct proto_ops inet_dccp_ops = { .family = PF_INET, .owner = THIS_MODULE, .release = inet_release, @@ -539,9 +539,11 @@ static int thash_entries; module_param(thash_entries, int, 0444); MODULE_PARM_DESC(thash_entries, "Number of ehash buckets"); +#ifdef CONFIG_IP_DCCP_DEBUG int dccp_debug; module_param(dccp_debug, int, 0444); MODULE_PARM_DESC(dccp_debug, "Enable debug messages"); +#endif static int __init dccp_init(void) { -- 2.39.2