[ofw] RE: Prefast patch

James Yang jyang at xsigo.com
Wed Apr 23 14:55:52 PDT 2008


Fab,

 

I have a few questions:

1) What's the right way to build the driver? Is there any document on
this?

    I was able to use DDK to build latest code. But WDK 6001.18000 has
quite a lot of problems.

2) Is DDK build still supported? Our product is still under DDK.

 

Thanks,

James

 

________________________________

From: Fab Tillier [mailto:ftillier at windows.microsoft.com] 
Sent: Friday, April 18, 2008 3:36 PM
To: James Yang; ofw at lists.openfabrics.org
Subject: RE: Prefast patch

 

What build environment are you using to run prefast?  I didn't get these
errors when building with the latest WDK (6001.18001).

 

-Fab

 

From: ofw-bounces at lists.openfabrics.org
[mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of James Yang
Sent: Friday, April 18, 2008 10:12 AM
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/20080423/c2ac968a/attachment.html>


More information about the ofw mailing list