osrusbfx2 fails static driver verifier

I’m using WDK 6001.18001 on a WXP box. I ran static driver verifier on the source code for osrusbfx2, which is part of the WDK distribution. That is, in a WXP FREE s shell, with current directory %BASEDIR%\osrusbfx2\sys\final, I ran

staticdv /rule:*

It complained that “No entry points have been approved in sdv-map for this driver”.
It found 3 Defects, described as

evtiostopcompleteorstopack
1
2
notpowerpolicyowner

What’s up with that?

If I make the change recommended by Brandon Wilson in Message 7 of

http://www.osronline.com/showthread.cfm?link=162745

that is, if I replace (ActionFlags==x) by (ActionFlags&x!=0) in two places,
staticdv then finds 4 defects, described as

evtiostopresume
evtiostopcompleteorstopack
1
2
notpowerpolicyowner

If your driver, part of the WDK distribution, doesn’t pass staticdv, why does mine have to?

Please use the latest WDK. I tried it (x86) and you will see only one error: evtiostopresume.
We have plans to fix it by (a) correct the validation rule or (b) add a Resume stub routine to remove this problem.

Thx.
Egi

xxxxx@juno.com wrote:

If your driver, part of the WDK distribution, doesn’t pass staticdv, why does mine have to?

I can answer that question.

No one says your driver has to pass SDV. However, you should WANT your
driver to pass SDV, because doing do means you have eliminated a number
of sources of difficult-to-find errors.

Microsoft also WANTS its drivers to pass SDV. The fact that they don’t
all do so does not in any way undermine the value of SDV. If anything,
it shows that SDV keeps getting better, catching potential errors that
it might have missed in the past.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I keep hoping SDV will handle C++ soon. I am writing some drivers in C++,
but avoiding most of the C++ features. No classes, member functions,
templates, etc. It is mostly standard C in a cpp file to get the greater
syntax checking from the compiler. I do use data declarations in for loops
to keep them local and if something needs to reference the loop control
variable after the loop terminates it makes me think about naming
conventions to make such usage more visible. I define all functions a “C”
to keep down the name mangling as I don’t have any need for overloads. I
also am using optional parameters with default values as that is a feature
that is so useful in some cases. If you want to record an error in a SRB
that may have an ASCQ or not, that feature is nice to be able to make all
but the SenseKey optional, but ensure the ASC & ASCQ get set correctly.

I don’t need any support functions to provide ‘new’ though there are easy
ways to use it with kernel code and still obtain all the capabilities of
being able to allocate non-paged or paged pool and do tagging. I want to
make it easier for anyone who follows the code to be able to adapt it easily
to straight C if needed. Some of the code may be reused in diagnostics
running under a DOS extender, Linux, or FreeBSD.

I just find that SDV blindly rejecting any cpp file to be excessive. I
compile with /W4 /WX and run prefast regularly. I wish OACR would work
better with the x64 code without coming up with bogus errors. Special
thanks to Mark Roddy for the defaults in ddkbuild.bat for Win7 7600.16385.0.

“Tim Roberts” wrote in message news:xxxxx@ntdev…
> xxxxx@juno.com wrote:
>> If your driver, part of the WDK distribution, doesn’t pass staticdv, why
>> does mine have to?
>>
>
> I can answer that question.
>
> No one says your driver has to pass SDV. However, you should WANT your
> driver to pass SDV, because doing do means you have eliminated a number
> of sources of difficult-to-find errors.
>
> Microsoft also WANTS its drivers to pass SDV. The fact that they don’t
> all do so does not in any way undermine the value of SDV. If anything,
> it shows that SDV keeps getting better, catching potential errors that
> it might have missed in the past.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>