From 3bbf032e09dfb3f3ea3f1b4f2da258675072d1a0 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 14 Aug 2015 18:10:55 +0300 Subject: [PATCH] validation: don't use uninitialized data Some stuff I'm working on complains that we don't initialize the local variables before using them. Make the variables global to silence these warnings. Signed-off-by: Dan Carpenter --- validation/sm_implied8.c | 4 ++-- validation/sm_wine_locking.c | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/validation/sm_implied8.c b/validation/sm_implied8.c index ff761469..3348f494 100644 --- a/validation/sm_implied8.c +++ b/validation/sm_implied8.c @@ -2,11 +2,11 @@ void frob(); +int test, test2; + int x; void func (void) { - int test, test2; - if (({int test = !!x; frob(); frob(); frob(); test;})) __smatch_value("x"); else diff --git a/validation/sm_wine_locking.c b/validation/sm_wine_locking.c index 0221c67f..10c03b54 100644 --- a/validation/sm_wine_locking.c +++ b/validation/sm_wine_locking.c @@ -7,13 +7,12 @@ void USER_Unlock(void); int GDI_GetObjPtr(int x); void GDI_ReleaseObj(int x); +int a, b, c, d, e, z; + void test1(void) { - int a; - int b = create_window_handle(a); - int c; - int d, e; - int z = frob(); + b = create_window_handle(a); + z = frob(); if (d = GDI_GetObjPtr(e)) GDI_ReleaseObj(e); @@ -37,10 +36,10 @@ void test1(void) * check-command: smatch -p=wine --spammy sm_wine_locking.c * * check-output-start -sm_wine_locking.c:28 test1() error: double unlock 'create_window_handle:b' -sm_wine_locking.c:30 test1() warn: 'CriticalSection:c' is sometimes locked here and sometimes unlocked. -sm_wine_locking.c:33 test1() warn: inconsistent returns 'USER_Lock:'. - Locked on: line 30 - Unlocked on: line 33 +sm_wine_locking.c:27 test1() error: double unlock 'create_window_handle:b' +sm_wine_locking.c:29 test1() warn: 'CriticalSection:c' is sometimes locked here and sometimes unlocked. +sm_wine_locking.c:32 test1() warn: inconsistent returns 'USER_Lock:'. + Locked on: line 29 + Unlocked on: line 32 * check-output-end */ -- 2.11.4.GIT