[ofw] Prefast patch
James Yang
jyang at xsigo.com
Sun Apr 27 16:57:48 PDT 2008
That's all for DDK. Will WDK support be checked in to trunk soon?
Thanks,
James
________________________________
From: Leonid Keller [mailto:leonid at mellanox.co.il]
Sent: Wednesday, April 23, 2008 8:51 AM
To: James Yang; ofw at lists.openfabrics.org
Subject: RE: [ofw] Prefast patch
Are there more lines that Prefast is not content with ?
Generally, i'd not like to add such changes in the transition period from DDK to WDK.
I'd postpone all the Prefast work till after that.
________________________________
From: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of James Yang
Sent: Friday, April 18, 2008 8:12 PM
To: ofw at lists.openfabrics.org
Subject: [ofw] Prefast patch
Hi,
I've made some modifications for the kernel mode driver to eliminate Prefast errors. Can someone help to review the patch and check them in if they're OK?
Patch file is also attached.
Thanks,
James
Index: inc/iba/ib_types.h
===================================================================
--- inc/iba/ib_types.h (revision 1060)
+++ inc/iba/ib_types.h (working copy)
@@ -221,7 +221,7 @@
*
* SOURCE
*/
-#define IB_DEFAULT_SUBNET_PREFIX (CL_HTON64(0xFE80000000000000ULL))
+#define IB_DEFAULT_SUBNET_PREFIX (CL_HTON64(CL_CONST64(0xFE80000000000000)))
/**********/
/****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX
@@ -2224,7 +2224,7 @@
IN const ib_gid_t* const p_gid )
{
return( ( ib_gid_get_subnet_prefix( p_gid ) &
- CL_HTON64( 0xFFFFFFFFFFFF0000ULL ) ) == CL_HTON64( 0xFEC0000000000000ULL ) );
+ CL_HTON64( CL_CONST64( 0xFFFFFFFFFFFF0000 ) ) ) == CL_HTON64( CL_CONST64( 0xFEC0000000000000 ) ) );
}
/*
* PARAMETERS
Index: inc/kernel/complib/cl_mutex_osd.h
===================================================================
--- inc/kernel/complib/cl_mutex_osd.h (revision 1060)
+++ inc/kernel/complib/cl_mutex_osd.h (working copy)
@@ -86,6 +86,10 @@
IN cl_mutex_t* const p_mutex )
{
CL_ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );
+ // Supressing Prefast Warning details are:
+ // warning 8103 : Leaking the resource stored in 'FastMutex:p_mutex'
+ // Path includes 3 statements on the following lines:
+ #pragma prefast(suppress:8103, "Suprressing next line for Prefast warning for reason mentioned above in comments")
ExAcquireFastMutex( p_mutex );
}
@@ -95,6 +99,10 @@
IN cl_mutex_t* const p_mutex )
{
CL_ASSERT( KeGetCurrentIrql() == APC_LEVEL );
+ // Supressing Prefast Warning details are:
+ // warning 8107 : The resource 'FastMutex:p_mutex' must be held when calling this function..
+ // Path includes 2 statements on the following lines:
+ #pragma prefast(suppress:8107, "Suprressing next line for Prefast warning for reason mentioned above in comments")
ExReleaseFastMutex( p_mutex );
}
Index: inc/kernel/complib/cl_spinlock_osd.h
===================================================================
--- inc/kernel/complib/cl_spinlock_osd.h (revision 1060)
+++ inc/kernel/complib/cl_spinlock_osd.h (working copy)
@@ -92,11 +92,21 @@
CL_ASSERT( p_spinlock );
if (irql == DISPATCH_LEVEL) {
+ // Supressing Prefast Warning details are:
+ // warning 8103 : Leaking the resource stored in 'SpinLock:p_spinlock->lock'.
+ // Path includes 7 statements on the following lines:
+ #pragma prefast(suppress:8103, "Suprressing next line for Prefast warning for reason mentioned above in comments")
KeAcquireSpinLockAtDpcLevel( &p_spinlock->lock );
p_spinlock->irql = irql;
}
else
+ {
+ // Supressing Prefast Warning details are:
+ // warning 8103 : Leaking the resource stored in 'SpinLock:p_spinlock->lock'.
+ // Path includes 7 statements on the following lines:
+ #pragma prefast(suppress:8103, "Suprressing next line for Prefast warning for reason mentioned above in comments")
KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );
+ }
}
@@ -107,9 +117,21 @@
CL_ASSERT( p_spinlock );
if (p_spinlock->irql == DISPATCH_LEVEL)
+ {
+ // Supressing Prefast Warning details are:
+ // warning 8107 : The resource 'SpinLock:p_spinlock->lock' must be held when calling this function..
+ // Path includes 7 statements on the following lines:
+ #pragma prefast(suppress:8107, "Suprressing next line for Prefast warning for reason mentioned above in comments")
KeReleaseSpinLockFromDpcLevel( &p_spinlock->lock );
+ }
else
+ {
+ // Supressing Prefast Warning details are:
+ // warning 8107 : The resource 'SpinLock:p_spinlock->lock' must be held when calling this function..
+ // Path includes 7 statements on the following lines:
+ #pragma prefast(suppress:8107, "Suprressing next line for Prefast warning for reason mentioned above in comments")
KeReleaseSpinLock( &p_spinlock->lock, p_spinlock->irql );
+ }
}
Index: inc/kernel/complib/cl_waitobj_osd.h
===================================================================
--- inc/kernel/complib/cl_waitobj_osd.h (revision 1060)
+++ inc/kernel/complib/cl_waitobj_osd.h (working copy)
@@ -58,8 +58,11 @@
* Assumption that if the call fails, the h_kevent parameter is unchanged,
* or set to NULL.
*/
- ObReferenceObjectByHandle( h_user_wait_obj, STANDARD_RIGHTS_ALL,
- *ExEventObjectType, UserMode, (PVOID*)&h_kevent, NULL );
+ // Supressing Prefast Warning details are:
+ // warning 8126 : The AccessMode parameter to ObReferenceObject* should be IRP->RequestorMode..
+ // Path includes 7 statements on the following lines:
+ #pragma prefast(suppress:8126, "Suprressing next line for Prefast warning for reason mentioned above in comments")
+ ObReferenceObjectByHandle( h_user_wait_obj, STANDARD_RIGHTS_ALL, *ExEventObjectType, UserMode, (PVOID*)&h_kevent, NULL );
return h_kevent;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20080427/d1d9eed6/attachment.html>
More information about the ofw
mailing list