diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2011-10-17 17:04:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-19 19:35:51 -0400 |
commit | 4f25af27827080c3163e59c7af1ca84a05ce121c (patch) | |
tree | 393c42c11b7876456b8cdca6f94ff5d7c301337b | |
parent | 79de9efdb93d8e693dccd0eb7d80cd6092f5875b (diff) |
filter: use unsigned int to silence static checker warning
This is just a cleanup.
My testing version of Smatch warns about this:
net/core/filter.c +380 check_load_and_stores(6)
warn: check 'flen' for negative values
flen comes from the user. We try to clamp the values here between 1
and BPF_MAXINSNS but the clamp doesn't work because it could be
negative. This is a bug, but it's not exploitable.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/filter.h | 2 | ||||
-rw-r--r-- | net/core/filter.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index 741956fa5bfd..8eeb205f298b 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
@@ -155,7 +155,7 @@ extern unsigned int sk_run_filter(const struct sk_buff *skb, | |||
155 | const struct sock_filter *filter); | 155 | const struct sock_filter *filter); |
156 | extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); | 156 | extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); |
157 | extern int sk_detach_filter(struct sock *sk); | 157 | extern int sk_detach_filter(struct sock *sk); |
158 | extern int sk_chk_filter(struct sock_filter *filter, int flen); | 158 | extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); |
159 | 159 | ||
160 | #ifdef CONFIG_BPF_JIT | 160 | #ifdef CONFIG_BPF_JIT |
161 | extern void bpf_jit_compile(struct sk_filter *fp); | 161 | extern void bpf_jit_compile(struct sk_filter *fp); |
diff --git a/net/core/filter.c b/net/core/filter.c index 8fcc2d776e09..5dea45279215 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -436,7 +436,7 @@ error: | |||
436 | * | 436 | * |
437 | * Returns 0 if the rule set is legal or -EINVAL if not. | 437 | * Returns 0 if the rule set is legal or -EINVAL if not. |
438 | */ | 438 | */ |
439 | int sk_chk_filter(struct sock_filter *filter, int flen) | 439 | int sk_chk_filter(struct sock_filter *filter, unsigned int flen) |
440 | { | 440 | { |
441 | /* | 441 | /* |
442 | * Valid instructions are initialized to non-0. | 442 | * Valid instructions are initialized to non-0. |