Kris Katterjohn wrote:
From: Patrick McHardy
Kris Katterjohn wrote:
--- x/net/core/filter.c 2005-12-28 16:51:35.000000000 -0600
+++ y/net/core/filter.c 2005-12-28 16:53:32.000000000 -0600
@@ -250,7 +250,7 @@ load_b:
mem[fentry->k] = X;
continue;
default:
- /* Invalid instruction counts as RET */
+ /* Should never be reached */
This stuff has had a number of bad bugs before, if it can't be reached,
please call BUG or something similar instead of silently ignoring the
error.
I'll just remove the default label and return statement.
Thats even worse, it will fall through to the second switch statement.
Just call BUG(), since it means you forgot to check something.
+ */
+ if (ftest->k == 0)
+ return -EINVAL;
Why do you keep the runtime check then?
The runtime is for BPF_ALU|BPF_DIV|BPF_X, not BPF_ALU|BPF_DIV|BPF_K. The BPF_K
instruction is constant and can be checked for at any time, but with BPF_X,
it changes with each packet and must be checked at runtime.
Ah, I missed that you already moved the check for div-by-constant
in a previous patch. So the entire point of this patch is to remove
the default-branch in the switch-statement? That hardly seems worth
the additional amount of code.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html