[MLX4] buxfix in WCHAR buffer length in RtlStringCchPrintfW function (winib 2459)
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 18 May 2008 14:05:45 +0000 (14:05 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Sun, 18 May 2008 14:05:45 +0000 (14:05 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1179 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mlx4/kernel/bus/core/l2w_debug.c
hw/mlx4/kernel/inc/mlx4_debug.h

index 551261d..6084303 100644 (file)
@@ -127,7 +127,7 @@ mlx4_err(
        va_end(list);
 
        // print to Event Log
        va_end(list);
 
        // print to Event Log
-       if (!RtlStringCchPrintfW(wbuf, sizeof(wbuf), L"%S", buf))
+       if (!RtlStringCchPrintfW(wbuf, sizeof(wbuf)/sizeof(wbuf[0]), L"%S", buf))
                WriteEventLogEntryStr( mdev->pdev->p_self_do, (ULONG)EVENT_MLX4_ANY_ERROR, 0, 0, wbuf, 0, 0 ); 
 }
 
                WriteEventLogEntryStr( mdev->pdev->p_self_do, (ULONG)EVENT_MLX4_ANY_ERROR, 0, 0, wbuf, 0, 0 ); 
 }
 
@@ -174,7 +174,7 @@ dev_err(
        va_end(list);
 
        // print to Event Log
        va_end(list);
 
        // print to Event Log
-       RtlStringCchPrintfW(wbuf, sizeof(wbuf), L"%S", buf);
+       RtlStringCchPrintfW(wbuf, sizeof(wbuf)/sizeof(wbuf[0]), L"%S", buf);
        WriteEventLogEntryStr( (*mdev)->pdev->p_self_do, (ULONG)EVENT_MLX4_ANY_ERROR, 0, 0, wbuf, 0, 0 ); 
 }
 
        WriteEventLogEntryStr( (*mdev)->pdev->p_self_do, (ULONG)EVENT_MLX4_ANY_ERROR, 0, 0, wbuf, 0, 0 ); 
 }
 
@@ -203,3 +203,4 @@ dev_info(
 }
 
 
 }
 
 
+
index 011913b..7141f35 100644 (file)
@@ -51,7 +51,7 @@ static void _build_str( const char *  format, ... )
        status = RtlStringCbVPrintfA((char *)g_slog_buf, sizeof(g_slog_buf), format , p_arg);\r
        if (status)\r
                goto end;\r
        status = RtlStringCbVPrintfA((char *)g_slog_buf, sizeof(g_slog_buf), format , p_arg);\r
        if (status)\r
                goto end;\r
-       status = RtlStringCchPrintfW(g_wlog_buf, sizeof(g_wlog_buf), L"%S", g_slog_buf);\r
+       status = RtlStringCchPrintfW(g_wlog_buf, sizeof(g_wlog_buf)/sizeof(g_wlog_buf[0]), L"%S", g_slog_buf);\r
        if (status)\r
                goto end;\r
 //     vsnprintf_s((char *)g_slog_buf, sizeof(g_slog_buf), _TRUNCATE, format , p_arg);\r
        if (status)\r
                goto end;\r
 //     vsnprintf_s((char *)g_slog_buf, sizeof(g_slog_buf), _TRUNCATE, format , p_arg);\r
@@ -191,3 +191,4 @@ end:
 #endif /*_MLX4_DEBUG_H_ */\r
 \r
 \r
 #endif /*_MLX4_DEBUG_H_ */\r
 \r
 \r
+\r