Skip to content

Commit

Permalink
KEYS: Fix variable uninitialisation warnings
Browse files Browse the repository at this point in the history
Fix variable uninitialisation warnings introduced in:

	commit 8bbf497
	Author: David Howells <[email protected]>
	Date:   Fri Nov 14 10:39:14 2008 +1100

	KEYS: Alter use of key instantiation link-to-keyring argument

As:

  security/keys/keyctl.c: In function 'keyctl_negate_key':
  security/keys/keyctl.c:976: warning: 'dest_keyring' may be used uninitialized in this function
  security/keys/keyctl.c: In function 'keyctl_instantiate_key':
  security/keys/keyctl.c:898: warning: 'dest_keyring' may be used uninitialized in this function

Some versions of gcc notice that get_instantiation_key() doesn't always set
*_dest_keyring, but fail to observe that if this happens then *_dest_keyring
will not be read by the caller.

Reported-by: Linus Torvalds <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
dhowells authored and James Morris committed Dec 29, 2008
1 parent 3c92ec8 commit eca1bf5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions security/keys/keyctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,11 +838,11 @@ static long get_instantiation_keyring(key_serial_t ringid,
{
key_ref_t dkref;

*_dest_keyring = NULL;

/* just return a NULL pointer if we weren't asked to make a link */
if (ringid == 0) {
*_dest_keyring = NULL;
if (ringid == 0)
return 0;
}

/* if a specific keyring is nominated by ID, then use that */
if (ringid > 0) {
Expand Down

0 comments on commit eca1bf5

Please sign in to comment.