[ofw] patch: [bus] fix bug in __read_dev_params.

Tzachi Dar tzachid at mellanox.co.il
Sun Nov 15 10:07:15 PST 2009


signed off by: Firas
 
Index: Q:/projinf3/trunk/hw/mlx4/kernel/bus/core/ev_log.mc
===================================================================
--- Q:/projinf3/trunk/hw/mlx4/kernel/bus/core/ev_log.mc (revision 5062)
+++ Q:/projinf3/trunk/hw/mlx4/kernel/bus/core/ev_log.mc (revision 5063)
@@ -155,4 +155,9 @@
 WdfDeviceOpenRegistryKey failed on opening SW (=driver) key for
mlx4_bus with status %2.
 .
 
+MessageId=0x0012 Facility=MLX4 Severity=Warning
SymbolicName=EVENT_MLX4_WARN_INVALID_PORT_TYPE_VALUE
+Language=English
+PortType registry parameter contains invalid value, PortType = %2.
+.
 
+
Index: Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c
===================================================================
--- Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 5062)
+++ Q:/projinf3/trunk/hw/mlx4/kernel/bus/drv/drv.c (revision 5063)
@@ -320,7 +320,7 @@
  DECLARE_CONST_UNICODE_STRING(PortType, L"PortType");
 
 #define  MAX_UVALUE 100
- WCHAR uvalue_data[MAX_UVALUE];
+ WCHAR uvalue_data[MAX_UVALUE]={0};
  UNICODE_STRING uvalue;    
  uvalue.Buffer = uvalue_data;
  uvalue.MaximumLength = MAX_UVALUE;
@@ -361,6 +361,8 @@
   uvalue.Length = 0;
  }
 
+    memset(&uvalue_data,0,sizeof(uvalue_data));
+
  status = WdfRegistryQueryUnicodeString(hParamsKey, &PortType, NULL,
&uvalue);
  if (NT_SUCCESS (status)) {
   if (!wcscmp(uvalue_data, L"ib,ib")) {
@@ -378,6 +380,10 @@
   if (!wcscmp(uvalue_data, L"eth,eth")) {
    dev_params->mod_port_type[0] = MLX4_PORT_TYPE_ETH;
    dev_params->mod_port_type[1] = MLX4_PORT_TYPE_ETH;
+  } else {
+      MLX4_PRINT( TRACE_LEVEL_ERROR  ,MLX4_DBG_DEV  ,("Invalid value,
PortType = %s\n", uvalue_data));            
+            WriteEventLogEntryData( pdev->p_self_do,
(ULONG)EVENT_MLX4_WARN_INVALID_PORT_TYPE_VALUE, 0, 0, 1,
+                L"%s",uvalue_data);      
   }
  }
  else {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20091115/607a466a/attachment.html>


More information about the ofw mailing list