In message <[EMAIL PROTECTED]>, walt writes:
>I need some of whatever it is you're taking.

Hehehehe :-)

What happened was that I spent too much time on a stupid bug in the
GEOM code, and decided that my life was too short for that.

I've worked with FlexeLint in my earlier life and decided that even
at my hourly rates, spending $1k on a good tool is good economy.

After running it on various bits of my own code I decided to let it
loose on LINT.  And what can I say ?  It finds bugs in our code!

Some are stylistic, some are potential some are actual.  As with
all tools, one should not blindly apply the output.

What makes this tool interesting compared to a normal lint, is a
feature called "specific walk".

As it goes, it tries to trace values and memory as best it can, and
it will record which functions are called with which values from
where.  It will then reexamine those functions in the light of those
possible paramter values and see if that looks sane.

I'll agree with bruce that this is nothing people can't do themselves,
but I think getting a program to do it may be faster and more reliable.

Here is an example of what it finds (this is not to pick on anybody,
it was just the first one I spotted now):

During Specific Walk:
  File ../../../ufs/ufs/ufs_vnops.c line 1757: ufs_makeinode(!=0, ?, ?, ?)
../../../ufs/ufs/ufs_vnops.c  2384  Warning 429: Custodial pointer 'acl' (line
    2265) has not been freed or returned

This basically says that ufs_makeinode() was called from line 1757 and the
first argument is know to be non-NULL, the others we know nothing about.

Tracing through ufs_makeinode(), it knows that malloc allocates memory and
tracks that "Custodial" pointer through the code and notices that we can
return from ufs_makeinode() without having disposed of the pointer in
some sensible way.

As far as I can tell, that means that a FREE(acl, M_ACL) is missing in
line 2384 and we have a really good and productive memory-leak if you
create files/directories in directories which don't have an ACL.

Now, $1k is not loose change, and a 5 concurrent user network license
for the cluster would cost $3k, but maybe we should put that on the
donations want list anyway ?  Or is this foundation work ?

Poul-Henning

PS: Flexelint is distributed as "obfuscated K&R C source", which compiles
on any and all system with a just moderately non-disgusting C compiler.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to