chris...@astron.com (Christos Zoulas) wrote: > >> > Module Name: src > >> > Committed By: rmind > >> > Date: Wed Aug 1 23:24:29 UTC 2012 > >> > > >> > <...> > >> > > >> > Log Message: > >> [...] > >> > Also, make few BPF fixes and > >> > simplifications while here. > >> [...] > > > >You've added a memset() to clear the scratch memory in > >bpf_filter(). We had this before... the point of > >bpf_validate() is to make sure that the filter program > >doesn't access uninitialized values. The runtime cost > >of clearing the array can thus be avoided. > >Or do you have reason to believe that the validator > >doesn't work as expected? > > Probably this code was copied from FreeBSD without knowing > that the code is tested at runtime. Yes, the whole point > is to not call memset on every invocation...
Right, I removed it. Also, thinking to use FreeBSD code for validation (plus checking for memwords we have). It seems to be simpler and faster: http://www.netbsd.org/~rmind/bpf_validate.diff -- Mindaugas