<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY dir=ltr>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Doron Tsur <BR><B>Sent:</B> Monday, July 
21, 2008 5:32 PM<BR><B>To:</B> anh.duong@qlogic.com; eleanor.witiak@qlogic.com; 
stan.smith@intel.com; Tzachi Dar; Leonid Keller<BR><B>Cc:</B> Doron Tsur; 
ofw@lists.openfabrics.org<BR><B>Subject:</B> [PATCH]: ALL: Reducing Prefast 
false alarms<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><SPAN class=446295407-21072008><FONT face=Arial><FONT size=2>I<SPAN 
class=373315511-21072008> have </SPAN>started to apply Prefast on 
WinOF code. <SPAN 
class=330393808-21072008> </SPAN></FONT></FONT></SPAN></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT face=Arial><FONT 
size=2><SPAN 
class=330393808-21072008></SPAN></FONT></FONT></SPAN></FONT> </DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT face=Arial><FONT 
size=2><SPAN class=330393808-21072008><SPAN class=446295407-21072008>Proposed 
SVN Commit log:</SPAN></SPAN></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT face=Arial><FONT 
size=2><SPAN class=330393808-21072008><SPAN 
class=446295407-21072008></SPAN></SPAN></FONT></FONT></SPAN></FONT> </DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><SPAN class=330393808-21072008><SPAN class=446295407-21072008>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial><FONT 
size=2><SPAN 
class=446295407-21072008>--------------------------------------------------------------------------------------------<SPAN 
class=446295407-21072008>--------------------------------------------------------------------------------------------</SPAN></SPAN>------------------<SPAN 
class=330393808-21072008> </SPAN></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial><FONT 
size=2><SPAN class=330393808-21072008></SPAN></FONT></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial><FONT 
size=2><SPAN 
class=330393808-21072008></SPAN></FONT></FONT></SPAN> </DIV></SPAN></SPAN></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
face=Arial><FONT size=2>Prefast is a static tool from Microsoft <SPAN 
class=330393808-21072008> , designated for driver developers over Windows 
platform to help find bugs.</SPAN></FONT></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><SPAN class=330393808-21072008></SPAN><FONT face=Arial><FONT 
size=2><SPAN class=330393808-21072008>Prefast provides both Microsoft specific 
issues and general issues (as NULL 
pointers). </SPAN></FONT></FONT></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><FONT face=Arial><FONT size=2><SPAN 
class=330393808-21072008></SPAN></FONT></FONT></FONT></FONT></SPAN></FONT> </DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><FONT size=+0><FONT face=Arial><FONT size=2><SPAN 
class=330393808-21072008>However, </SPAN> Prefast often has false 
alarms <SPAN 
class=330393808-21072008> . </SPAN></FONT></FONT></FONT></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><FONT size=+0><FONT size=+0><FONT face=Arial><FONT size=2><SPAN 
class=330393808-21072008>T</SPAN>here are ways to remove these false alarms 
by<SPAN 
class=330393808-21072008> :</SPAN></FONT></FONT></FONT></FONT></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><FONT size=+0><FONT size=+0><FONT face=Arial><FONT size=2><SPAN 
class=330393808-21072008></SPAN></FONT></FONT></FONT></FONT></FONT></FONT></SPAN></FONT> </DIV>
<OL>
  <LI><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
  size=+0><FONT size=+0><FONT size=+0><FONT face=Arial><FONT size=2><SPAN 
  class=330393808-21072008>When Using ASSERT in a non-memory allocation pointer, 
  Prefast is not aware of the check ASSERT 
  performs.</SPAN></FONT></FONT></FONT></FONT></FONT></FONT></SPAN></FONT><FONT 
  size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT size=+0><FONT 
  size=+0><FONT size=+0><FONT face=Arial><FONT size=2><SPAN 
  class=330393808-21072008> 
  <LI><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
  size=+0><FONT size=+0><FONT size=+0><FONT size=+0><FONT size=+0><FONT 
  size=+0><FONT size=+0><FONT face=Arial><FONT size=2><SPAN 
  class=330393808-21072008>Suppress the Prefast warning if the developer if 
  there is an issue with no impact (For example, comparing constants in a code 
  protected by #ifdef _DEBUG_ has no impact on fre built 
  code.</SPAN></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT></SPAN></FONT></LI></OL></SPAN></FONT></FONT></FONT></FONT></FONT></FONT></SPAN></FONT>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><FONT size=+0><FONT size=+0><FONT size=+0><FONT face=Arial><FONT 
size=2>In this patch I remove some of Prefast false alarms<SPAN 
class=330393808-21072008> :</SPAN></FONT></FONT></FONT></FONT></FONT></FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT size=+0><FONT 
size=+0><FONT size=+0><FONT size=+0><FONT size=+0><FONT face=Arial><FONT 
size=2><SPAN 
class=330393808-21072008></SPAN></FONT></FONT></FONT></FONT></FONT></FONT></FONT></SPAN></FONT> </DIV>
<DIV><FONT size=+0><SPAN class=446295407-21072008><FONT face=Arial 
size=2>Removing false Prefast alarms by:</DIV></FONT>
<OL>
  <LI>
  <DIV align=left><FONT face=Arial size=2>Adding __analysis_assume() to ASSERT 
  when DBG and _PREFAST_ are used for use in all the <SPAN 
  class=373315511-21072008><FONT color=#0000ff><FONT 
  color=#000000>WinOF</FONT> </FONT></SPAN>tree.</FONT></DIV><FONT 
  face=Arial>
  <OL>
    <LI><FONT size=2>/trunk/inc/kernel/complib/cl_types_osd.h</FONT></FONT> 
    <LI><FONT face=Arial 
    size=2>/trunk/inc/user/complib/cl_types_osd.h</FONT></LI></OL>
  <LI>
  <DIV align=left><FONT face=Arial size=2>Adding 
  __pragma(warning(suppress:6326)) to suppress constants compare warning 
  (performance decrease is acceptable since this is chked code/ heavy windows 
  event logging:</FONT></DIV>
  <OL>
    <LI><FONT face=Arial size=2>Adding __pragma(warning(suppress:6326)) in debug 
    MACROs:</FONT> 
    <OL>
      <LI><FONT face=Arial size=2>/trunk/core/al/al_debug.h</FONT> 
      <LI><FONT face=Arial size=2>/trunk/inc/complib/cl_debug.h</FONT> 
      <LI><FONT face=Arial>
      <DIV dir=ltr align=left><FONT face=Arial 
      size=2>/trunk/ulp/ipoib/kernel/ipoib_debug.h</FONT></DIV></FONT></LI></OL>
    <LI><FONT face=Arial size=2>Adding __pragma(warning(suppress:6326)) in 
    Events logging:</FONT> 
    <OL>
      <LI><FONT face=Arial 
    size=2>/trunk/hw/mthca/kernel/hca_debug.h</FONT></LI></OL></LI></OL></LI></OL>
<DIV dir=ltr align=left><FONT face=Arial><FONT face=Arial size=2>
<DIV dir=ltr align=left><FONT face=Arial><FONT size=2><FONT size=2><SPAN 
class=446295407-21072008><SPAN 
class=446295407-21072008>--------------------------------------------------------------------------------------------<SPAN 
class=446295407-21072008>--------------------------------------------------------------------------------------------</SPAN></SPAN>------------------</SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT size=2><FONT size=2><SPAN 
class=446295407-21072008></SPAN></FONT></FONT></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT size=2><FONT color=#0000ff 
size=2><SPAN 
class=446295407-21072008></SPAN></FONT></FONT></FONT> </DIV></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial size=2>Tests<SPAN 
class=446295407-21072008> (On WinOF tree)</SPAN>:</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT face=Arial 
size=2></FONT></FONT> </DIV>
<OL>
  <LI dir=ltr><FONT face=Arial size=2>Build for chk, fre, x86 and AMD64 for 2003 
  and 2008 servers (8 builds). (After SVN update, and on <SPAN 
  class=330393808-21072008> WinOF </SPAN>tree<SPAN 
  class=330393808-21072008> ) </SPAN> , <SPAN 
  class=373315511-21072008><FONT color=#0000ff> </FONT></SPAN></FONT><FONT 
  face=Arial size=2>using 6001.18001 DDK.</FONT> <SPAN 
  class=373315511-21072008><FONT face=Arial color=#0000ff 
  size=2> </FONT></SPAN> 
  <LI dir=ltr><FONT size=+0><SPAN class=446295407-21072008><FONT face=Arial 
  size=2>Run 6001.18001 DDK Prefast</FONT></SPAN></LI></OL></FONT>
<DIV dir=ltr align=left><FONT face=Arial><FONT face=Arial 
size=2></FONT></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial><FONT 
size=2><SPAN class=975133014-21072008><FONT color=#0000ff><FONT 
color=#000000>Tested</FONT> </FONT></SPAN>SVN Version of 
WinOF:</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT size=2>142<SPAN 
class=821482612-21072008>5 </SPAN></FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT face=Arial 
size=2></FONT></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial size=2>Modified files: 
</FONT></DIV><FONT color=#0000ff>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 
size=2>/trunk/core/al/al_debug.h</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 
size=2>/trunk/hw/mthca/kernel/hca_debug.h</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 
size=2>/trunk/inc/complib/cl_debug.h</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 
size=2>/trunk/inc/kernel/complib/cl_types_osd.h</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 
size=2>/trunk/inc/user/complib/cl_types_osd.h</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 
size=2>/trunk/ulp/ipoib/kernel/ipoib_debug.h</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#000000 
size=2></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial 
color=#000000 size=2>Diff:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial 
color=#000000 size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial 
color=#000000 size=2>See attached file of unified diff.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT face=Arial 
color=#000000 size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008><FONT color=#000000><FONT 
size=2><FONT face=Arial>Doron Tsur <SPAN class=330393808-21072008><FONT 
color=#0000ff> < </FONT></SPAN></FONT></FONT><A 
href="mailto:doront@mellanox.co.il"><FONT face=Arial 
size=2>doront@mellanox.co.il</FONT></A></FONT><SPAN 
class=330393808-21072008><FONT face=Arial color=#0000ff 
size=2> > </FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=446295407-21072008></SPAN><FONT face=Arial 
color=#000000 size=2></FONT> </DIV></FONT></SPAN></FONT></BODY></HTML>