Quiet valgrind warnings in init_current_teb

Dan Kegel dank at kegel.com
Sat May 13 15:25:42 CDT 2006


The command
/usr/local/valgrind-3.1.1/bin/valgrind  --workaround-gcc296-bugs=yes
--trace-children=yes ~/wine/wine notepad
complains:
==11170== Conditional jump or move depends on uninitialised value(s)
==11170==    at 0x7BF00EB1: init_current_teb (../include/wine/library.h:130)
==11170==    by 0x42E68EA: thread_init (thread.c:242)
==11170==    by 0x42C52A6: __wine_process_init (loader.c:2337)
==11170==    by 0x4024903: wine_init (loader.c:636)
==11170==    by 0x7BF00F9F: main (main.c:58)

The following patchlet makes the warnings go away:

--- loader/kthread.c    6 Feb 2006 13:35:57 -0000       1.16
+++ loader/kthread.c    13 May 2006 20:22:12 -0000
@@ -301,6 +301,7 @@
     /* On the i386, the current thread is in the %fs register */
     LDT_ENTRY fs_entry;

+    memset(&fs_entry, 0, sizeof(fs_entry));    /* avoid valgrind warnings */
     wine_ldt_set_base( &fs_entry, info->teb_base );
     wine_ldt_set_limit( &fs_entry, info->teb_size - 1 );
     wine_ldt_set_flags( &fs_entry, WINE_LDT_FLAGS_DATA|WINE_LDT_FLAGS_32BIT );
===================================================================
--- loader/pthread.c    14 Feb 2006 13:32:37 -0000      1.13
+++ loader/pthread.c    13 May 2006 20:22:12 -0000
@@ -117,6 +117,7 @@
     /* On the i386, the current thread is in the %fs register */
     LDT_ENTRY fs_entry;

+    memset(&fs_entry, 0, sizeof(fs_entry));    /* avoid valgrind warnings */
     wine_ldt_set_base( &fs_entry, info->teb_base );
     wine_ldt_set_limit( &fs_entry, info->teb_size - 1 );
     wine_ldt_set_flags( &fs_entry, WINE_LDT_FLAGS_DATA|WINE_LDT_FLAGS_32BIT );

-- 
Wine for Windows ISVs: http://kegel.com/wine/isv



More information about the wine-patches mailing list