[PATCH] remove NULL pointers from vfs_ops struct

Stefan (metze) Metzmacher metze at metzemix.de
Tue May 13 05:57:16 GMT 2003

At 18:37 12.05.2003 +0300, Alexander Bokovoy wrote:
>On Mon, May 12, 2003 at 08:26:39AM -0700, Esh, Andrew wrote:
> > I had issues with this code a while back, where someone managed to call the
> > null pointer in a VFS module. I submitted a patch that fixed the specific
> > problem. This fix appears to me to address all of those issues, and has the
> > added value of removing a lot of null pointer testing code that I was
> > interested in removing. This is a more correct fix.
> > To codify what we've learned: It seems to me that there should be a policy
> > that the function pointers in the ops structure should never be null.

with the current code it's not possible for a function null pointer to go 
into the vfs_ops struct :-)

> > Perhaps an assert could enforce this. A VFS module should always do one of
> > the following with each function:
> >
> > 1. Override the function with a valid function.
> > 2. Override the function with a non-operational function which returns a
> > correct error value.
> > 3. Not override the function, leaving the default function in place.
> >
> > In cases 1 & 2, if those functions do not handle the call, they should call
> > the default function, which must also not be null.
>I'll make sure this will go into VFS API reference and module writers
>Instead of assert, I think appropriate check needs to be in smbd's module
>registration function, which should check that an array of pointers passed
>back from module contains only non-NULL pointers for VFS operations.
>Fortunately, we are already using VFS_OP(NULL) as an indicator of the end
>of the array so no processing will be done after that element.

that the point :-)

Stefan "metze" Metzmacher <metze at metzemix.de> 

More information about the samba-technical mailing list