This removes redundant comments, and moves one comment to a better location.
Signed-off-by: Kris Katterjohn <[EMAIL PROTECTED]>
We all ready know the filter must end with a RET instruction because it says so
in the header comment for sk_chk_filter(). And I think the header comment is a
better place to say that the jumps are always forward.
-EINVAL is always returned for an error, so we'd might as well just say that.
Let me know what you think. Thanks!
--- x/net/core/filter.c 2006-01-12 14:13:21.000000000 -0600
+++ y/net/core/filter.c 2006-01-12 14:50:54.000000000 -0600
@@ -287,7 +287,9 @@ load_b:
* no references or jumps that are out of range, no illegal
* instructions, and must end with a RET instruction.
*
- * Returns 0 if the rule set is legal or a negative errno code if not.
+ * All jumps are forward as they are not signed.
+ *
+ * Returns 0 if the rule set is legal or -EINVAL if not.
*/
int sk_chk_filter(struct sock_filter *filter, int flen)
{
@@ -299,7 +301,6 @@ int sk_chk_filter(struct sock_filter *fi
/* check the filter code now */
for (pc = 0; pc < flen; pc++) {
- /* all jumps are forward as they are not signed */
ftest = &filter[pc];
/* Only allow valid instructions */
@@ -383,11 +384,6 @@ int sk_chk_filter(struct sock_filter *fi
}
}
- /*
- * The program must end with a return. We don't care where they
- * jumped within the script (its always forwards) but in the end
- * they _will_ hit this.
- */
return (BPF_CLASS(filter[flen - 1].code) == BPF_RET) ? 0 : -EINVAL;
}
-
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