netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 3/8] nf_conntrack: sparse warnings
Date: Thu, 24 Jan 2008 10:15:39 -0800	[thread overview]
Message-ID: <20080124181628.162252995@vyatta.com> (raw)
In-Reply-To: 20080124181536.446214111@vyatta.com

[-- Attachment #1: nf-hashtable.patch --]
[-- Type: text/plain, Size: 2330 bytes --]

The hashtable size is really unsigned so sparse complains when you pass
a signed integer.  Change all uses to make it consistent.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/include/net/netfilter/nf_conntrack.h	2008-01-23 10:24:42.000000000 -0800
+++ b/include/net/netfilter/nf_conntrack.h	2008-01-23 10:25:05.000000000 -0800
@@ -171,9 +171,9 @@ static inline void nf_ct_put(struct nf_c
 extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
 extern void nf_ct_l3proto_module_put(unsigned short l3proto);
 
-extern struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced);
+extern struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced);
 extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced,
-				 int size);
+				 unsigned int size);
 
 extern struct nf_conntrack_tuple_hash *
 __nf_conntrack_find(const struct nf_conntrack_tuple *tuple,
--- a/net/netfilter/nf_conntrack_core.c	2008-01-23 10:23:37.000000000 -0800
+++ b/net/netfilter/nf_conntrack_core.c	2008-01-23 10:26:48.000000000 -0800
@@ -939,7 +939,7 @@ static int kill_all(struct nf_conn *i, v
 	return 1;
 }
 
-void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, int size)
+void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, unsigned int size)
 {
 	if (vmalloced)
 		vfree(hash);
@@ -988,7 +988,7 @@ void nf_conntrack_cleanup(void)
 	nf_conntrack_expect_fini();
 }
 
-struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
+struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced)
 {
 	struct hlist_head *hash;
 	unsigned int size, i;
@@ -1015,8 +1015,8 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable)
 
 int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
 {
-	int i, bucket, hashsize, vmalloced;
-	int old_vmalloced, old_size;
+	int i, bucket, vmalloced, old_vmalloced;
+	unsigned int hashsize, old_size;
 	int rnd;
 	struct hlist_head *hash, *old_hash;
 	struct nf_conntrack_tuple_hash *h;
@@ -1025,7 +1025,7 @@ int nf_conntrack_set_hashsize(const char
 	if (!nf_conntrack_htable_size)
 		return param_set_uint(val, kp);
 
-	hashsize = simple_strtol(val, NULL, 0);
+	hashsize = simple_strtoul(val, NULL, 0);
 	if (!hashsize)
 		return -EINVAL;
 

-- 
Stephen Hemminger <stephen.hemminger@vyatta.com>


  parent reply	other threads:[~2008-01-24 18:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-24 18:15 [PATCH 0/8] trivial patches to netfilter for net-2.6.25 Stephen Hemminger
2008-01-24 18:15 ` [PATCH 1/8] nf_nat_snmp: sparse warning Stephen Hemminger
2008-01-24 18:32   ` Patrick McHardy
2008-01-24 18:15 ` [PATCH 2/8] netfilter: get rid of " Stephen Hemminger
2008-01-24 18:34   ` Patrick McHardy
2008-01-24 18:15 ` Stephen Hemminger [this message]
2008-01-24 18:35   ` [PATCH 3/8] nf_conntrack: sparse warnings Patrick McHardy
2008-01-24 18:15 ` [PATCH 4/8] netfilter: more sparse warning fixes Stephen Hemminger
2008-01-24 18:40   ` Patrick McHardy
2008-01-24 18:15 ` [PATCH 5/8] conntrack: get rid of sparse warnings Stephen Hemminger
2008-01-24 18:42   ` Patrick McHardy
2008-01-24 18:15 ` [PATCH 6/8] nf_conntrack-h323: sparse fixes Stephen Hemminger
2008-01-24 18:44   ` Patrick McHardy
2008-01-24 18:15 ` [PATCH 7/8] netfilter: more spase fixes Stephen Hemminger
2008-01-24 18:43   ` Patrick McHardy
2008-01-24 18:15 ` [PATCH 8/8] nf_conntrack ipv6: unused code and sparse fix Stephen Hemminger
2008-01-24 18:45   ` Patrick McHardy
2008-01-25  1:24     ` Yasuyuki KOZAKAI
2008-01-28  2:50       ` Yasuyuki KOZAKAI
     [not found]       ` <200801280250.m0S2oWF1019241@toshiba.co.jp>
2008-01-29 12:54         ` Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080124181628.162252995@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).