On Monday 2012-05-14 15:56, Alban Crequy wrote: >With the NFPROTO_* constants introduced by commit 7e9c6e ("netfilter: Introduce >NFPROTO_* constants"), it is too easy to confuse PF_* and NFPROTO_* constants >in new protocols. >index e1b7e05..4f16552 100644 >--- a/net/netfilter/core.c >+++ b/net/netfilter/core.c >@@ -67,6 +67,11 @@ int nf_register_hook(struct nf_hook_ops *reg) > struct nf_hook_ops *elem; > int err; > >+ if (reg->pf >= NFPROTO_NUMPROTO || reg->hooknum >= NF_MAX_HOOKS) { >+ BUG(); >+ return 1; >+ } Like always, I'd prefer a WARN() instead, here paired with return -EINVAL. Especially when the error path is (seems) simple, halting the entire machine does not look very nice. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html