From f2f95a935f05c2ea3df534b6b5da4d02debeda2e Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Sun, 15 Jan 2017 01:03:35 +0100 Subject: [PATCH] kernel: fix use of uninitialized value in freelist_pop CID 156233 (#1 of 1): Uninitialized pointer read (UNINIT)5. uninit_use: Using uninitialized value fimg. --- sys/src/kern/port/umem/images.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/src/kern/port/umem/images.c b/sys/src/kern/port/umem/images.c index be37c43..0374512 100644 --- a/sys/src/kern/port/umem/images.c +++ b/sys/src/kern/port/umem/images.c @@ -280,6 +280,8 @@ freelist_pop(int blankslot, int originally_allocated) unsigned short *next, *fptr; ImagePointer ptr = 0; + fimg = nil; + wlock(&pool_lock); /* if more blanks have been allocated after blankslot, @@ -287,7 +289,8 @@ freelist_pop(int blankslot, int originally_allocated) * instead */ if(originally_allocated < pool.allocated){ - return pool.allocated - blankslot; + ptr = pool.allocated - blankslot; + goto Done; } if(pool.sleeping == 0)