Strange PREfast error + verifier stats not getting updated

Hi,

I have been using the driver verifier and PREfast (from the Win2003 DDK)
to find out problems with my driver. And I have been having some odd
problems with both,

When I build under PREfast (prefast build -cZ), the defect list includes
this line:

IoSetCompletionRoutine(irp,
USBwinReadWrite_Complete, pCfContext, TRUE, TRUE, TRUE);

with this warning:

usbaccess.c(701) : warning 314: Incorrect order of operations: bitwise-or has higher precedence than the conditional-expression operator. Add parenthesies to clarify intent.
problem occurs in function ‘AsyncCallUSBD’

I can’t understand the problem. The statement in question does not have
bitwise-or or the conditional-expression operators. What is PREfast trying
to tell me?

And the driver verifier stats aren’t getting updated.

The driver verifier settings are:

C:\userdata\hchhaya\net>verifier /querysettings
Special pool: Enabled
Force IRQL checking: Enabled
Low resources simulation: Disabled
Pool tracking: Enabled
I/O verification: Enabled
Deadlock detection: Enabled
Enhanced I/O verification: Disabled
DMA checking: Enabled

Verified drivers:

umacusb.sys

However, I don’t see any updated stats when the driver is loaded
and working:

C:\userdata\hchhaya\net>verifier /query
12/30/2004, 12:18:03 PM
Level: 000000BB
RaiseIrqls: 0
AcquireSpinLocks: 0
SynchronizeExecutions: 0
AllocationsAttempted: 0
AllocationsSucceeded: 0
AllocationsSucceededSpecialPool: 0
AllocationsWithNoTag: 0
AllocationsFailed: 0
AllocationsFailedDeliberately: 0
Trims: 0
UnTrackedPool: 0

Verified drivers:

Name: umacusb.sys, loads: 4, unloads: 3
CurrentPagedPoolAllocations: 0
CurrentNonPagedPoolAllocations: 0
PeakPagedPoolAllocations: 0
PeakNonPagedPoolAllocations: 0
PagedPoolUsageInBytes: 0
NonPagedPoolUsageInBytes: 0
PeakPagedPoolUsageInBytes: 0
PeakNonPagedPoolUsageInBytes: 0

I see a non-zero number of allocs from non-paged memory in the
PoolTag utility for the tag used by the driver.

Should I be setting some environment variable or some registry entry
for the verifier to update its stats?

Thanks,

  • Harshal

Actually, the statement does have bitwise operators since
IoSetCompletionRoutine is a macro, see below:

#define IoSetCompletionRoutine( Irp, Routine, CompletionContext, Success,
Error, Cancel ) { \
PIO_STACK_LOCATION irpSp;
\
ASSERT( (Success) | (Error) | (Cancel) ? (Routine) != NULL : TRUE );
\
irpSp = IoGetNextIrpStackLocation( (Irp) );
\
irpSp->CompletionRoutine = (Routine);
\
irpSp->Context = (CompletionContext);
\
irpSp->Control = 0;
\
if ((Success)) { irpSp->Control = SL_INVOKE_ON_SUCCESS; }
\
if ((Error)) { irpSp->Control |= SL_INVOKE_ON_ERROR; }
\
if ((Cancel)) { irpSp->Control |= SL_INVOKE_ON_CANCEL; } }

For right now just ignore it. Microsoft I believe has fixed it in the 2003
SP1 DDK.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Harshal Chhaya” wrote in message news:xxxxx@ntdev…
>
>
>
> Hi,
>
> I have been using the driver verifier and PREfast (from the Win2003 DDK)
> to find out problems with my driver. And I have been having some odd
> problems with both,
>
>
> When I build under PREfast (prefast build -cZ), the defect list includes
> this line:
>
> IoSetCompletionRoutine(irp,
> USBwinReadWrite_Complete, pCfContext, TRUE, TRUE, TRUE);
>
> with this warning:
>
> usbaccess.c(701) : warning 314: Incorrect order of operations: bitwise-or
has higher precedence than the conditional-expression operator. Add
parenthesies to clarify intent.
> problem occurs in function ‘AsyncCallUSBD’
>
>
> I can’t understand the problem. The statement in question does not have
> bitwise-or or the conditional-expression operators. What is PREfast trying
> to tell me?
>
>
> And the driver verifier stats aren’t getting updated.
>
> The driver verifier settings are:
>
>
> C:\userdata\hchhaya\net>verifier /querysettings
> Special pool: Enabled
> Force IRQL checking: Enabled
> Low resources simulation: Disabled
> Pool tracking: Enabled
> I/O verification: Enabled
> Deadlock detection: Enabled
> Enhanced I/O verification: Disabled
> DMA checking: Enabled
>
> Verified drivers:
>
> umacusb.sys
>
>
> However, I don’t see any updated stats when the driver is loaded
> and working:
>
>
> C:\userdata\hchhaya\net>verifier /query
> 12/30/2004, 12:18:03 PM
> Level: 000000BB
> RaiseIrqls: 0
> AcquireSpinLocks: 0
> SynchronizeExecutions: 0
> AllocationsAttempted: 0
> AllocationsSucceeded: 0
> AllocationsSucceededSpecialPool: 0
> AllocationsWithNoTag: 0
> AllocationsFailed: 0
> AllocationsFailedDeliberately: 0
> Trims: 0
> UnTrackedPool: 0
>
> Verified drivers:
>
> Name: umacusb.sys, loads: 4, unloads: 3
> CurrentPagedPoolAllocations: 0
> CurrentNonPagedPoolAllocations: 0
> PeakPagedPoolAllocations: 0
> PeakNonPagedPoolAllocations: 0
> PagedPoolUsageInBytes: 0
> NonPagedPoolUsageInBytes: 0
> PeakPagedPoolUsageInBytes: 0
> PeakNonPagedPoolUsageInBytes: 0
>
>
> I see a non-zero number of allocs from non-paged memory in the
> PoolTag utility for the tag used by the driver.
>
> Should I be setting some environment variable or some registry entry
> for the verifier to update its stats?
>
>
>
> Thanks,
> - Harshal
>
>
>

Don Burn wrote:

Actually, the statement does have bitwise operators since
IoSetCompletionRoutine is a macro, see below:

That explains it. Thanks!

Regards,

  • Harshal