Skip to contentSkip to conversation

KEYS: potential uninitialized variable

PATCH Applied Dan Carpenter 2 participants 2 messages May 26, 2016 – May 27, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KEYS: potential uninitialized variable

If __key_link_begin() failed then "edit" would be uninitialized. I've added a check to fix that.

Fixes f70e2e06196a ('KEYS: Do preallocation for __key_link()')
security/keys/key.c +1 -1
index bd5a272..346fbf2 100644
@@ -597,7 +597,7 @@ int key_reject_and_link(struct key *key,
 
 	mutex_unlock(&key_construction_mutex);
 
-	if (keyring)
+	if (keyring && link_ret = 0)
 		__key_link_end(keyring, &key->index_key, edit);
 
 	/* wake up anyone waiting for a key to be constructed */
maintainer Applied
#1 lore raw
Quoted 5 lines · Dan Carpenter

If __key_link_begin() failed then "edit" would be uninitialized. I've added a check to fix that.

Fixes f70e2e06196a ('KEYS: Do preallocation for __key_link()')

Applied.